File tree 1 file changed +18
-1
lines changed
ql/ql/src/codeql_ql/style
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -288,6 +288,8 @@ private File benignUnqueryableFile() {
288
288
result .getAbsolutePath ( ) .matches ( "%/ql/ql/test%" )
289
289
}
290
290
291
+ import NodeName
292
+
291
293
/**
292
294
* Gets an AstNode that does not affect any query result.
293
295
* Is interresting as an quick-eval target to investigate dead code.
@@ -297,5 +299,20 @@ AstNode unQueryable() {
297
299
not result = queryable ( ) and
298
300
not result = deprecated ( ) and
299
301
not result = benignUnqueryable ( ) and
300
- not result .getParent ( ) = any ( AstNode node | not node = queryable ( ) )
302
+ not result .getParent ( ) = any ( AstNode node | not node = queryable ( ) ) and
303
+ // remove where a queryable feature with the "same" name exists.
304
+ not exists ( AstNode other , string name |
305
+ name = getName ( result , _) and
306
+ name = oppositeFirstLetter ( getName ( other , _) ) and
307
+ other .getParent ( ) = result .getParent ( )
308
+ )
309
+ }
310
+
311
+ bindingset [ name]
312
+ string oppositeFirstLetter ( string name ) {
313
+ exists ( string first | first = name .prefix ( 1 ) |
314
+ if first .toUpperCase ( ) = first
315
+ then result = first .toLowerCase ( ) + name .suffix ( 1 )
316
+ else result = first .toUpperCase ( ) + name .suffix ( 1 )
317
+ )
301
318
}
You can’t perform that action at this time.
0 commit comments