github / github/codeql

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

Abierto
#10,199 3 comentarios 1 reacción 0 asignados Ver en GitHub
question
Lenguaje dominante
CodeQL
Estrellas
10.1k
Forks
2.1k
Merge medio
2 d 15 h
PR fusionados (30 d)
141

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.