mirror of
https://github.com/github/codeql.git
synced 2026-07-27 05:51:56 +02:00
The ones that no longer require points-to no longer import `LegacyPointsTo`. The ones that do use the specific `...MetricsWithPointsTo` classes that are applicable.
21 lines
556 B
Plaintext
21 lines
556 B
Plaintext
/**
|
|
* @name Percentage of comments
|
|
* @description The percentage of lines in a file that contain comments. Note that docstrings are
|
|
* reported by a separate metric.
|
|
* @kind treemap
|
|
* @id py/comment-ratio-per-file
|
|
* @treemap.warnOn lowValues
|
|
* @metricType file
|
|
* @metricAggregate avg max
|
|
* @tags maintainability
|
|
* documentation
|
|
*/
|
|
|
|
import python
|
|
|
|
from ModuleMetrics mm
|
|
where mm.getNumberOfLines() > 0
|
|
select mm,
|
|
100.0 * (mm.getNumberOfLinesOfComments().(float) / mm.getNumberOfLines().(float)) as ratio
|
|
order by ratio desc
|