File tree Expand file tree Collapse file tree
java/ql/consistency-queries Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import java
2+ import semmle.code.configfiles.ConfigFiles
23
34// Locations should either be :0:0:0:0 locations (UnknownLocation, or
45// a whole file), or all 4 fields should be positive.
@@ -15,7 +16,20 @@ Location backwardsLocation() {
1516 result .getStartColumn ( ) > result .getEndColumn ( )
1617}
1718
19+ Location unusedLocation ( ) {
20+ not exists ( Top t | t .getLocation ( ) = result ) and
21+ not exists ( XMLLocatable x | x .getLocation ( ) = result ) and
22+ not exists ( ConfigLocatable c | c .getLocation ( ) = result ) and
23+ not ( result .getFile ( ) .getExtension ( ) = "xml" and
24+ result .getStartLine ( ) = 0 and
25+ result .getStartColumn ( ) = 0 and
26+ result .getEndLine ( ) = 0 and
27+ result .getEndColumn ( ) = 0 )
28+ }
29+
1830from Location l
19- where l = badLocation ( ) or l = backwardsLocation ( )
31+ where l = badLocation ( )
32+ or l = backwardsLocation ( )
33+ or l = unusedLocation ( )
2034select l
2135
You can’t perform that action at this time.
0 commit comments