Skip to content

Commit f872ed1

Browse files
QL: Add query for class docs that don't start with an article.
Returns quite a few results, many of which seem to be TPs.
1 parent 4cb4073 commit f872ed1

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @name Class QLDoc style.
3+
* @description The QLDoc for a class should start with "A", "An", or "The".
4+
* @kind problem
5+
* @problem.severity warning
6+
* @id ql/class-doc-style
7+
* @tags maintainability
8+
* @precision very-high
9+
*/
10+
11+
import ql
12+
13+
bindingset[s]
14+
predicate badStyle(string s) {
15+
not s.replaceAll("/**", "")
16+
.replaceAll("*", "")
17+
.splitAt("\n")
18+
.trim()
19+
.matches(["A %", "An %", "The %"])
20+
}
21+
22+
from Class c
23+
where
24+
badStyle(c.getQLDoc().getContents()) and
25+
not c.isPrivate()
26+
select c.getQLDoc(), "The QLDoc for a class should start with 'A', 'An', or 'The'."

0 commit comments

Comments
 (0)