Skip to content

Commit af00f4f

Browse files
committed
updated checkstyle config
refactored suppression helpers
1 parent 127bb36 commit af00f4f

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ More information in [wiki page](https://github.com/adireddy/haxe-checkstyle/wiki
5757
"tokens": [ "NOTINLINE" ]
5858
}
5959
},
60+
{
61+
"type": "Dynamic",
62+
"props": {
63+
"severity": "INFO"
64+
}
65+
},
6066
{
6167
"type": "EmptyLines",
6268
"props": {

checkstyle/checks/Check.hx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,20 @@ class Check {
6363
for (j in 0 ... i + 1) {
6464
pos += _checker.lines[j].length;
6565
}
66-
for (td in _checker.ast.decls) {
67-
switch (td.decl){
68-
case EClass(d):
69-
for (field in d.data) {
70-
if (pos > field.pos.max) continue;
71-
if (pos < field.pos.min) continue;
72-
return isCheckSuppressed (field);
73-
}
74-
default:
75-
}
76-
}
77-
return false;
66+
return isCharPosSuppressed (pos);
7867
}
7968

8069
function isPosSuppressed(pos:Position):Bool {
70+
return isCharPosSuppressed (pos.min);
71+
}
72+
73+
function isCharPosSuppressed(pos:Int):Bool {
8174
for (td in _checker.ast.decls) {
8275
switch (td.decl){
8376
case EClass(d):
8477
for (field in d.data) {
85-
if (pos.min > field.pos.max) continue;
86-
if (pos.min < field.pos.min) continue;
78+
if (pos > field.pos.max) continue;
79+
if (pos < field.pos.min) continue;
8780
return isCheckSuppressed (field);
8881
}
8982
default:

resources/config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
]
5555
}
5656
},
57+
{
58+
"type": "Dynamic",
59+
"props": {
60+
"severity": "INFO"
61+
}
62+
},
5763
{
5864
"type": "EmptyLines",
5965
"props": {

0 commit comments

Comments
 (0)