mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
patch upper-case acronyms to be PascalCase
This commit is contained in:
@@ -35,7 +35,7 @@ where
|
||||
// the variable should be accessed somewhere; otherwise it will be flagged by UnusedVariable
|
||||
exists(v.getAnAccess()) and
|
||||
// don't flag ambient variable definitions
|
||||
not dead.(ASTNode).isAmbient() and
|
||||
not dead.(AstNode).isAmbient() and
|
||||
// don't flag variables with ambient uses
|
||||
not exists(LexicalAccess access |
|
||||
access.getALexicalName() = v.getADeclaration().getALexicalName() and
|
||||
@@ -55,7 +55,7 @@ where
|
||||
// don't flag default inits that are later overwritten
|
||||
not (isDefaultInit(dead.getSource().(Expr).getUnderlyingValue()) and dead.isOverwritten(v)) and
|
||||
// don't flag assignments in externs
|
||||
not dead.(ASTNode).inExternsFile() and
|
||||
not dead.(AstNode).inExternsFile() and
|
||||
// don't flag exported variables
|
||||
not any(ES2015Module m).exportsAs(v, _) and
|
||||
// don't flag 'exports' assignments in closure modules
|
||||
@@ -70,5 +70,5 @@ where
|
||||
else msg = "The value assigned to " + v.getName() + " here is unused."
|
||||
) and
|
||||
// ignore Angular templates
|
||||
not dead.(ASTNode).getTopLevel() instanceof Angular2::TemplateTopLevel
|
||||
not dead.(AstNode).getTopLevel() instanceof Angular2::TemplateTopLevel
|
||||
select dead, msg
|
||||
|
||||
@@ -101,7 +101,7 @@ predicate isDeadAssignment(string name, DataFlow::PropWrite assign1, DataFlow::P
|
||||
noPropAccessBetweenInsideBasicBlock(name, assign1, assign2) or
|
||||
noPropAccessBetweenAcrossBasicBlocks(name, assign1, assign2)
|
||||
) and
|
||||
not isDOMProperty(name)
|
||||
not isDomProperty(name)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,20 +37,20 @@ predicate isPropertyFilter(UnusedLocal v) {
|
||||
}
|
||||
|
||||
predicate hasJsxInScope(UnusedLocal v) {
|
||||
any(JSXNode n).getParent+() = v.getScope().getScopeElement()
|
||||
any(JsxNode n).getParent+() = v.getScope().getScopeElement()
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `v` is a "React" variable that is implicitly used by a JSX element.
|
||||
*/
|
||||
predicate isReactForJSX(UnusedLocal v) {
|
||||
predicate isReactForJsx(UnusedLocal v) {
|
||||
hasJsxInScope(v) and
|
||||
(
|
||||
v.getName() = "React"
|
||||
or
|
||||
exists(TopLevel tl | tl = v.getADeclaration().getTopLevel() |
|
||||
// legacy `@jsx` pragmas
|
||||
exists(JSXPragma p | p.getTopLevel() = tl | p.getDOMName() = v.getName())
|
||||
exists(JsxPragma p | p.getTopLevel() = tl | p.getDomName() = v.getName())
|
||||
or
|
||||
// JSX pragma from a .babelrc file
|
||||
exists(Babel::TransformReactJsxConfig plugin |
|
||||
@@ -59,7 +59,7 @@ predicate isReactForJSX(UnusedLocal v) {
|
||||
)
|
||||
)
|
||||
or
|
||||
exists(JSONObject tsconfig |
|
||||
exists(JsonObject tsconfig |
|
||||
tsconfig.isTopLevel() and tsconfig.getFile().getBaseName() = "tsconfig.json"
|
||||
|
|
||||
v.getName() =
|
||||
@@ -148,7 +148,7 @@ predicate whitelisted(UnusedLocal v) {
|
||||
isPropertyFilter(v)
|
||||
or
|
||||
// exclude imports of React that are implicitly referenced by JSX
|
||||
isReactForJSX(v)
|
||||
isReactForJsx(v)
|
||||
or
|
||||
// exclude names that are used as types
|
||||
exists(VarDecl vd | v = vd.getVariable() |
|
||||
@@ -198,7 +198,7 @@ predicate unusedImports(ImportVarDeclProvider provider, string msg) {
|
||||
)
|
||||
}
|
||||
|
||||
from ASTNode sel, string msg
|
||||
from AstNode sel, string msg
|
||||
where
|
||||
(
|
||||
unusedNonImports(sel, msg) or
|
||||
|
||||
Reference in New Issue
Block a user