Skip to content

Commit 0cadf5d

Browse files
committed
generating default checks report on check style itself
1 parent f1a4b19 commit 0cadf5d

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

CHECKS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
###Report of default checks on CheckStyle library itself
2+
3+
`Info: LINE - 4: Invalid enum member signature: INFO (name should be ~/^[a-z]+[a-zA-Z0-9]*$/)`
4+
5+
`Info: LINE - 5: Invalid enum member signature: WARNING (name should be ~/^[a-z]+[a-zA-Z0-9]*$/)`
6+
7+
`Info: LINE - 6: Invalid enum member signature: ERROR (name should be ~/^[a-z]+[a-zA-Z0-9]*$/)`
8+
9+
`Total Issues: 3 (Errors: 0 Warnings: 0 Infos: 3)`

build.hxml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
-cp resources
2-
-cmd echo "*** Default check - no config ***"
32
-cmd neko run -s checkstyle -r xml -p resources/static-analysis.xml
43
-x StaticAnalysis
54

6-
--next
7-
-cp resources
8-
-cmd echo "*** Default check - with config ***"
9-
-cmd neko run -s checkstyle -c ./resources/config.json -r xml -p resources/static-analysis.xml
10-
-x StaticAnalysis
11-
125
-cmd rm StaticAnalysis.n
136
--next
147

resources/StaticAnalysis.hx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package ;
22

3+
import sys.io.FileOutput;
34
import sys.io.File;
45

56
class StaticAnalysis {
67

78
var _staticAnalysisXML:Xml;
9+
var _reportFile:FileOutput;
810

911
public function new() {
1012
_staticAnalysisXML = Xml.parse(File.getContent("./resources/static-analysis.xml"));
13+
_reportFile = File.write("CHECKS.md", false);
14+
_reportFile.writeString("###Report of default checks on CheckStyle library itself\n\n");
1115
var errors = 0;
1216
var warnings = 0;
1317
var infos = 0;
@@ -23,18 +27,23 @@ class StaticAnalysis {
2327
case "error":
2428
errors++;
2529
Sys.println("\t\033[91mError: LINE - " + errorNode.get("line") + ": " + StringTools.htmlUnescape(errorNode.get("message")) + "\033[0m");
30+
_reportFile.writeString("`Error: LINE - " + errorNode.get("line") + ": " + StringTools.htmlUnescape(errorNode.get("message")) + "`\n\n");
2631
case "warning":
2732
warnings++;
2833
Sys.println("\t\033[95mWarning: LINE - " + errorNode.get("line") + ": " + StringTools.htmlUnescape(errorNode.get("message")) + "\033[0m");
34+
_reportFile.writeString("`Warning: LINE - " + errorNode.get("line") + ": " + StringTools.htmlUnescape(errorNode.get("message")) + "`\n\n");
2935
case "info":
3036
infos++;
3137
Sys.println("\t\033[94mInfo: LINE - " + errorNode.get("line") + ": " + StringTools.htmlUnescape(errorNode.get("message")) + "\033[0m");
38+
_reportFile.writeString("`Info: LINE - " + errorNode.get("line") + ": " + StringTools.htmlUnescape(errorNode.get("message")) + "`\n\n");
3239
}
3340
total++;
3441
}
3542
}
3643

3744
Sys.println("\033[1m\nTotal Issues: " + total + " (\033[0m\033[91mErrors: " + errors + "\033[0m, \033[95mWarnings: " + warnings + "\033[0m, \033[94mInfos: " + infos + ")\n" + "\033[0m");
45+
46+
_reportFile.writeString("`Total Issues: " + total + " (Errors: " + errors + " Warnings: " + warnings + " Infos: " + infos + ")`");
3847
}
3948

4049
static function main() {

resources/static-analysis.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<file name="checkstyle&#x2F;checks&#x2F;BlockFormatCheck.hx">
1010
</file>
1111
<file name="checkstyle&#x2F;checks&#x2F;Check.hx">
12-
<error line="83" column="2" severity="error" message="Function &quot;isCharPosSuppressed&quot; is too complex (score: 32)." source="checkstyle&#x2F;checks&#x2F;Check.hx"/>
1312
</file>
1413
<file name="checkstyle&#x2F;checks&#x2F;ConstantNameCheck.hx">
1514
</file>
@@ -78,6 +77,9 @@
7877
<file name="checkstyle&#x2F;LintFile.hx">
7978
</file>
8079
<file name="checkstyle&#x2F;LintMessage.hx">
80+
<error line="4" column="2" severity="info" message="Invalid enum member signature: INFO (name should be ~&#x2F;^[a-z]+[a-zA-Z0-9]*$&#x2F;)" source="checkstyle&#x2F;LintMessage.hx"/>
81+
<error line="5" column="2" severity="info" message="Invalid enum member signature: WARNING (name should be ~&#x2F;^[a-z]+[a-zA-Z0-9]*$&#x2F;)" source="checkstyle&#x2F;LintMessage.hx"/>
82+
<error line="6" column="2" severity="info" message="Invalid enum member signature: ERROR (name should be ~&#x2F;^[a-z]+[a-zA-Z0-9]*$&#x2F;)" source="checkstyle&#x2F;LintMessage.hx"/>
8183
</file>
8284
<file name="checkstyle&#x2F;Main.hx">
8385
</file>

test/MemberNameCheckTest.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,4 @@ class MemberNameTests {
152152
VALUE;
153153
}";
154154

155-
}
155+
}

0 commit comments

Comments
 (0)