github / github/codeql

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

Aberta
#10,199 3 comentários 1 reação 0 responsáveis Ver no GitHub
question
Linguagem predominante
CodeQL
Estrelas
10.1k
Forks
2.1k
Merge médio
2d 15h
PRs com merge (30d)
141

Descrição

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.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.