Skip to content

Commit 74e99e2

Browse files
committed
chore: update
1 parent eb722e6 commit 74e99e2

2 files changed

Lines changed: 111 additions & 1 deletion

File tree

.github/workflows/antlr-lint.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,17 @@ jobs:
262262
echo "| File | Status |" >> $GITHUB_STEP_SUMMARY
263263
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
264264
265+
# Get config file path from environment
266+
config_opt=""
267+
if [ -f "${{ matrix.path }}/antlr-lint.json" ]; then
268+
config_opt="--config ${{ matrix.path }}/antlr-lint.json"
269+
elif [ -f "antlr-lint.json" ]; then
270+
config_opt="--config antlr-lint.json"
271+
fi
272+
265273
for file in $(find ${{ matrix.path }} -name "*.g4" -type f | sort); do
266274
# Check if this file had issues
267-
output=$(antlr-lint lint "$file" 2>&1)
275+
output=$(antlr-lint lint $config_opt "$file" 2>&1)
268276
if echo "$output" | grep -E "ERROR|WARNING" > /dev/null; then
269277
echo "| \`${file}\` | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
270278
else

antlr-lint.json

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
{
2+
"rules": {
3+
"S001": {
4+
"description": "Main parser rule should end with EOF token",
5+
"enabled": true,
6+
"severity": "error"
7+
},
8+
"S002": {
9+
"description": "Duplicate rule definition",
10+
"enabled": true,
11+
"severity": "warning"
12+
},
13+
"S003": {
14+
"description": "Invalid grammar declaration",
15+
"enabled": true,
16+
"severity": "error"
17+
},
18+
"N001": {
19+
"description": "Parser rule should start with lowercase letter",
20+
"enabled": true,
21+
"severity": "error"
22+
},
23+
"N002": {
24+
"description": "Lexer rule should start with uppercase letter",
25+
"enabled": true,
26+
"severity": "error"
27+
},
28+
"N003": {
29+
"description": "Rule name doesn't follow camelCase/UPPER_CASE convention",
30+
"enabled": true,
31+
"severity": "warning"
32+
},
33+
"L001": {
34+
"description": "Missing labels for alternatives in parser rules",
35+
"enabled": true,
36+
"severity": "warning"
37+
},
38+
"L002": {
39+
"description": "Inconsistent label naming convention",
40+
"enabled": true,
41+
"severity": "info"
42+
},
43+
"L003": {
44+
"description": "Duplicate label names within the same rule",
45+
"enabled": true,
46+
"severity": "warning"
47+
},
48+
"C001": {
49+
"description": "Rule exceeds complexity thresholds",
50+
"enabled": true,
51+
"severity": "warning",
52+
"thresholds": {
53+
"maxAlternatives": 10,
54+
"maxNestingDepth": 5,
55+
"maxTokens": 50
56+
}
57+
},
58+
"C002": {
59+
"description": "Deeply nested rule structure",
60+
"enabled": true,
61+
"severity": "warning"
62+
},
63+
"C003": {
64+
"description": "Very long rule definition (consider breaking it up)",
65+
"enabled": true,
66+
"severity": "info"
67+
},
68+
"T001": {
69+
"description": "Overlapping token definitions",
70+
"enabled": true,
71+
"severity": "warning"
72+
},
73+
"T002": {
74+
"description": "Unreachable token rule",
75+
"enabled": true,
76+
"severity": "warning"
77+
},
78+
"T003": {
79+
"description": "Token defined but never used",
80+
"enabled": true,
81+
"severity": "info"
82+
},
83+
"E001": {
84+
"description": "Missing error recovery strategy",
85+
"enabled": false,
86+
"severity": "info"
87+
},
88+
"E002": {
89+
"description": "Potential ambiguity in grammar",
90+
"enabled": true,
91+
"severity": "warning"
92+
}
93+
},
94+
"excludePatterns": [
95+
"*.generated.g4",
96+
"*Test*.g4",
97+
"node_modules/**/*.g4",
98+
"dist/**/*.g4",
99+
"build/**/*.g4"
100+
],
101+
"outputFormat": "text"
102+
}

0 commit comments

Comments
 (0)