github / github/codeql

Java: `getNumberOfCommentLines` and `getNumberOfLinesOfCode` should only exist for supported classes

Aperta
#10,199 3 commenti 1 reazione 0 assegnatari Vedi su GitHub
question
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

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):
- `XMLFile`
- `CompilationUnit`
- `Package`
- `Class`
- `Callable`
- _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 least `XMLFile`)

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.