mirror of
https://github.com/github/codeql.git
synced 2026-02-08 19:21:07 +01:00
Add query for class docs that don't start with an article.
Returns quite a few results, many of which seem to be TPs.
This commit is contained in:
26
ql/src/queries/style/docs/ClassDocs.ql
Normal file
26
ql/src/queries/style/docs/ClassDocs.ql
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @name Class QLDoc style.
|
||||
* @description The QLDoc for a class should start with "A", "An", or "The".
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id ql/class-doc-style
|
||||
* @tags maintainability
|
||||
* @precision very-high
|
||||
*/
|
||||
|
||||
import ql
|
||||
|
||||
bindingset[s]
|
||||
predicate badStyle(string s) {
|
||||
not s.replaceAll("/**", "")
|
||||
.replaceAll("*", "")
|
||||
.splitAt("\n")
|
||||
.trim()
|
||||
.matches(["A %", "An %", "The %"])
|
||||
}
|
||||
|
||||
from Class c
|
||||
where
|
||||
badStyle(c.getQLDoc().getContents()) and
|
||||
not c.isPrivate()
|
||||
select c.getQLDoc(), "The QLDoc for a class should start with 'A', 'An', or 'The'."
|
||||
Reference in New Issue
Block a user