Skip to content

Commit 6058352

Browse files
committed
QL for QL: add small test for misspelling query
1 parent 4321b5e commit 6058352

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
| Test.qll:1:1:3:3 | QLDoc | This QLDoc comment contains the common misspelling 'mispelled', which should instead be 'misspelled'. |
2+
| Test.qll:4:1:11:1 | Class PublicallyAccessible | This class name contains the common misspelling 'publically', which should instead be 'publicly'. |
3+
| Test.qll:5:3:5:20 | FieldDecl | This field name contains the common misspelling 'occurences', which should instead be 'occurrences'. |
4+
| Test.qll:10:3:10:36 | ClassPredicate hasAgrument | This classPredicate name contains the common misspelling 'agrument', which should instead be 'argument'. |
5+
| Test.qll:13:1:16:3 | QLDoc | This QLDoc comment contains the non-US spelling 'colour', which should instead be 'color'. |
6+
| Test.qll:17:1:22:1 | Class AnalysedInt | This class name contains the non-US spelling 'analysed', which should instead be 'analyzed'. |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
queries/style/Misspelling.ql
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* A string that's deliberately mispelled (and so is that last word).
3+
*/
4+
class PublicallyAccessible extends string {
5+
int numOccurences; // should be 'occurrences'
6+
7+
PublicallyAccessible() { this = "publically" and numOccurences = 123 }
8+
9+
// should be argument
10+
predicate hasAgrument() { none() }
11+
}
12+
13+
/**
14+
* A class whose name contains a British-English spelling.
15+
* And here's the word 'colour'.
16+
*/
17+
class AnalysedInt extends int {
18+
AnalysedInt() { this = 7 }
19+
20+
// 'analyses' should not be flagged
21+
int numAnalyses() { result = 1 }
22+
}

0 commit comments

Comments
 (0)