/*** @name Omitted array element* @description Omitted elements in array literals are easy to miss and should not be used.* @kind problem* @problem.severity recommendation* @id js/omitted-array-element* @tags maintainability* readability* language-features* @precision low*/import javascript/*** An initial omitted element in an array expression.** This is represented by the corresponding array expression, with a special* `hasLocationInfo` implementation that assigns it a location covering the* first omitted array element.*/class OmittedArrayElement extends ArrayExpr {int idx;OmittedArrayElement() { idx = min(int i | this.elementIsOmitted(i)) }/*** Holds if this element is at the specified location.* The location spans column `startcolumn` of line `startline` to* column `endcolumn` of line `endline` in file `filepath`.* For more information, see* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).*/predicate hasLocationInfo(string filepath, int startline, int startcolumn, int endline, int endcolumn) {exists(Token pre, Location before, Location after |idx = 0 and pre = this.getFirstToken()orpre = this.getElement(idx - 1).getLastToken().getNextToken()|before = pre.getLocation() andafter = pre.getNextToken().getLocation() andbefore.hasLocationInfo(filepath, startline, startcolumn, _, _) andafter.hasLocationInfo(_, _, _, endline, endcolumn))}}from OmittedArrayElement aeselect ae, "Avoid omitted array elements."
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。