Skip to content

Commit 2ea2bd8

Browse files
committed
refine the repeated-word query
1 parent cb3a0fb commit 2ea2bd8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ql/ql/src/queries/style/RepeatedWord.ql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ string getWord(Comment node) { result = node.getContents().regexpFind("\\b[A-Za-
1414

1515
Comment hasRepeatedWord(string word) {
1616
word = getWord(result) and
17-
result.getContents().regexpMatch(".*\\b" + word + "\\s+" + word + "\\b.*")
17+
result.getContents().regexpMatch(".*[\\s]" + word + "\\s+" + word + "[\\s.,].*")
1818
}
1919

2020
from Comment comment, string word
21-
where comment = hasRepeatedWord(word)
21+
where
22+
comment = hasRepeatedWord(word) and
23+
// lots of these, and I can't just change old dbschemes.
24+
not (word = "type" and comment.getLocation().getFile().getExtension() = "dbscheme")
2225
select comment, "The comment repeats " + word + "."

0 commit comments

Comments
 (0)