github / github/codeql

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

Đang mở
#10,199 3 bình luận 1 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.