codeql
codeql copied to clipboard
Java: `getNumberOfCommentLines` and `getNumberOfLinesOfCode` should only exist for supported classes
trafficstars
The predicates getNumberOfCommentLines() and getNumberOfLinesOfCode() are currently defined for Top, however they only seem to have results for the following CodeQL classes (list might be incomplete):
XMLFileCompilationUnitPackageClassCallable- some weird element which has
getPrimaryQlClasses() = "???",getAQlClass() = "Top"and which has no location (they seem to be duplicating some of the elements listed above, at leastXMLFile)
This can be quite confusing, for example when you try to use the predicates for Stmt (or specifically for BlockStmt). Maybe it would therefore be good to move the predicate to the classes where they actually work, or at least clearly mention in the documentation that these predicates do not work for most elements.
Thank you for raising this - this definitely sounds like something to improve. We'll try to have a look when time permits.