Skip to content

Commit f1aa8b0

Browse files
committed
Merge branch 'dev'
2 parents b997f3a + 0e5a1b9 commit f1aa8b0

18 files changed

+885
-441
lines changed

CHECKS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66

77
`Info: LINE - 6: Invalid enum member signature: ERROR (name should be ~/^[a-z]+[a-zA-Z0-9]*$/)`
88

9-
`Total Issues: 3 (Errors: 0 Warnings: 0 Infos: 3)`
9+
`Info: LINE - 7: Invalid enum member signature: IGNORE (name should be ~/^[a-z]+[a-zA-Z0-9]*$/)`
10+
11+
`Total Issues: 4 (Errors: 0 Warnings: 0 Infos: 4)`

README.md

Lines changed: 2 additions & 365 deletions
Original file line numberDiff line numberDiff line change
@@ -14,372 +14,9 @@ Please note that this project was derived from [haxelint](https://github.com/mch
1414
haxelib install checkstyle
1515
```
1616

17-
###Configuration
18-
19-
More information in [wiki page](https://github.com/adireddy/haxe-checkstyle/wiki/Haxe-Checkstyle).
20-
21-
```json
22-
{
23-
"checks": [
24-
{
25-
"type": "AccessOrder",
26-
"props": {
27-
"severity": "WARNING",
28-
"modifiers": [
29-
"MACRO",
30-
"OVERRIDE",
31-
"PUBLIC_PRIVATE",
32-
"STATIC",
33-
"INLINE",
34-
"DYNAMIC"
35-
]
36-
}
37-
},
38-
{
39-
"type": "Anonymous",
40-
"props": {
41-
"severity": "ERROR"
42-
}
43-
},
44-
{
45-
"type": "ArrayInstantiation",
46-
"props": {
47-
"severity": "ERROR"
48-
}
49-
},
50-
{
51-
"type": "BlockFormat",
52-
"props": {
53-
"severity": "ERROR",
54-
"option": "empty"
55-
}
56-
},
57-
{
58-
"type": "ConstantName",
59-
"props": {
60-
"severity": "ERROR",
61-
"format": "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$",
62-
"tokens": [
63-
"INLINE"
64-
]
65-
}
66-
},
67-
{
68-
"type": "CyclomaticComplexity",
69-
"props": {
70-
"thresholds": [
71-
{
72-
"severity": "WARNING",
73-
"complexity": 20
74-
},
75-
{
76-
"severity": "ERROR",
77-
"complexity": 30
78-
}
79-
]
80-
}
81-
},
82-
{
83-
"type": "Dynamic",
84-
"props": {
85-
"severity": "INFO"
86-
}
87-
},
88-
{
89-
"type": "EmptyLines",
90-
"props": {
91-
"severity": "INFO",
92-
"maxConsecutiveEmptyLines": 1
93-
}
94-
},
95-
{
96-
"type": "ERegInstantiation",
97-
"props": {
98-
"severity": "ERROR"
99-
}
100-
},
101-
{
102-
"type": "FileLength",
103-
"props": {
104-
"severity": "WARNING",
105-
"max": 2000
106-
}
107-
},
108-
{
109-
"type": "HexadecimalLiterals",
110-
"props": {
111-
"severity": "INFO"
112-
}
113-
},
114-
{
115-
"type": "IndentationCharacter",
116-
"props": {
117-
"severity": "INFO",
118-
"character": "tab"
119-
}
120-
},
121-
{
122-
"type": "LeftCurly",
123-
"props": {
124-
"severity": "WARNING",
125-
"option": "eol",
126-
"tokens": [
127-
"CLASS_DEF",
128-
"ENUM_DEF",
129-
"ABSTRACT_DEF",
130-
"TYPEDEF_DEF",
131-
"CLASS_DEF",
132-
"INTERFACE_DEF",
133-
"OBJECT_DECL",
134-
"FUNCTION",
135-
"FOR",
136-
"IF",
137-
"WHILE",
138-
"SWITCH",
139-
"TRY",
140-
"CATCH"
141-
]
142-
}
143-
},
144-
{
145-
"type": "LineLength",
146-
"props": {
147-
"severity": "ERROR",
148-
"maxCharacters": 200
149-
}
150-
},
151-
{
152-
"type": "ListenerName",
153-
"props": {
154-
"severity": "ERROR",
155-
"listeners": [
156-
"addEventListener",
157-
"addListener",
158-
"on",
159-
"once"
160-
]
161-
}
162-
},
163-
{
164-
"type": "LocalVariableName",
165-
"props": {
166-
"severity": "ERROR",
167-
"format": "^[a-z]+[a-zA-Z0-9]*$"
168-
}
169-
},
170-
{
171-
"type": "MemberName",
172-
"props": {
173-
"severity": "ERROR",
174-
"format": "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$",
175-
"tokens": [
176-
"ENUM"
177-
]
178-
}
179-
},
180-
{
181-
"type": "MemberName",
182-
"props": {
183-
"severity": "ERROR",
184-
"format": "^[a-z]+[a-zA-Z0-9]*$",
185-
"tokens": [
186-
"PUBLIC",
187-
"PRIVATE",
188-
"TYPEDEF"
189-
]
190-
}
191-
},
192-
{
193-
"type": "MethodLength",
194-
"props": {
195-
"severity": "ERROR",
196-
"maxFunctionLines": 50
197-
}
198-
},
199-
{
200-
"type": "MethodName",
201-
"props": {
202-
"severity": "ERROR",
203-
"format": "^[a-z]+[a-zA-Z0-9]*$",
204-
"tokens": []
205-
}
206-
},
207-
{
208-
"type": "NeedBraces",
209-
"props": {
210-
"severity": "WARNING",
211-
"allowSingleLineStatement": true,
212-
"tokens": []
213-
}
214-
},
215-
{
216-
"type": "NestedForDepth",
217-
"props": {
218-
"severity": "ERROR",
219-
"max": 1
220-
}
221-
},
222-
{
223-
"type": "NestedIfDepth",
224-
"props": {
225-
"severity": "ERROR",
226-
"max": 1
227-
}
228-
},
229-
{
230-
"type": "NestedTryDepth",
231-
"props": {
232-
"severity": "ERROR",
233-
"max": 1
234-
}
235-
},
236-
{
237-
"type": "Override",
238-
"props": {
239-
"severity": "ERROR"
240-
}
241-
},
242-
{
243-
"type": "ParameterName",
244-
"props": {
245-
"severity": "ERROR",
246-
"format": "^[a-z]+[a-zA-Z0-9]*$"
247-
}
248-
},
249-
{
250-
"type": "ParameterNumber",
251-
"props": {
252-
"severity": "INFO",
253-
"max": 7,
254-
"ignoreOverriddenMethods": false
255-
}
256-
},
257-
{
258-
"type": "PublicPrivate",
259-
"props": {
260-
"severity": "INFO"
261-
}
262-
},
263-
{
264-
"type": "Return",
265-
"props": {
266-
"severity": "INFO",
267-
"allowEmptyReturn": true
268-
}
269-
},
270-
{
271-
"type": "Spacing",
272-
"props": {
273-
"severity": "INFO",
274-
"spaceIfCondition": true,
275-
"spaceAroundBinop": true,
276-
"spaceAroundBinop": true,
277-
"ignoreRangeOperator": true
278-
}
279-
},
280-
{
281-
"type": "TabForAligning",
282-
"props": {
283-
"severity": "INFO"
284-
}
285-
},
286-
{
287-
"type": "TODOComment",
288-
"props": {
289-
"severity": "INFO"
290-
}
291-
},
292-
{
293-
"type": "TrailingWhitespace",
294-
"props": {
295-
"severity": "INFO"
296-
}
297-
},
298-
{
299-
"type": "Type",
300-
"props": {
301-
"severity": "ERROR"
302-
}
303-
},
304-
{
305-
"type": "TypeName",
306-
"props": {
307-
"severity": "ERROR",
308-
"format": "^I[A-Z]+[a-zA-Z0-9]*$",
309-
"tokens": [
310-
"INTERFACE"
311-
]
312-
}
313-
},
314-
{
315-
"type": "TypeName",
316-
"props": {
317-
"severity": "ERROR",
318-
"format": "^[A-Z]+[a-zA-Z0-9]*$",
319-
"tokens": [
320-
"CLASS",
321-
"ENUM",
322-
"TYPEDEF"
323-
]
324-
}
325-
},
326-
{
327-
"type": "VariableInitialisation",
328-
"props": {
329-
"severity": "ERROR"
330-
}
331-
}
332-
]
333-
}
334-
```
335-
336-
###SuppressWarnings
337-
338-
Note that the warnings can be suppressed at class/method level as shown below.
339-
340-
`@SuppressWarnings("checkstyle:Dynamic", "checkstyle:MethodLength")`
341-
342-
###Options
343-
344-
To see all the options available run the following command.
345-
346-
`haxelib run checkstyle`
347-
348-
```
349-
[-p | --path] <loc> : Set reporter path
350-
[-x | --xslt] <x> : Set reporter style (XSLT)
351-
[-r | --reporter] <reporterName> : Set reporter
352-
[-c | --config] <configPath> : Set config file
353-
[--list-checks] : List all checks
354-
[--list-reporters] : List all reporters
355-
[-report] : Generate build time report
356-
[-s | --source] <sourcePath> : Set sources to process
357-
```
358-
###Compile Time Report
359-
360-
Now when using default `xml` reporting, you can display readable compile time report in console by passing `-report` option.
361-
362-
`haxelib run checkstyle -s src -p report.xml -report`
363-
364-
###Hudson and Bamboo Integration
365-
366-
You can generate the report in checkstyle XML format that can be integrated with Hudson and Bamboo easily.
367-
368-
You can also set XSLT style for the XML generated. See the sample below.
369-
370-
`haxelib run checkstyle -s src -c config.json -p report.xml -x report.xsl`
371-
372-
Sample Hudson Checkstyle Trend Chart:
373-
374-
![hudson](https://raw.githubusercontent.com/adireddy/haxe-checkstyle/master/hudson.png)
375-
37617
###Reference
37718

378-
http://checkstyle.sourceforge.net
379-
380-
http://haxe.org/manual/class-field-visibility.html
381-
382-
http://adireddy.github.io/haxe/haxe-access-modifiers-return-types
19+
[More information and reference](https://adireddy.gitbooks.io/haxe-checkstyle/content/).
38320

38421
###Issues
38522

@@ -394,4 +31,4 @@ This content is released under the [MIT](http://opensource.org/licenses/MIT) Lic
39431

39532
### Contributor Code of Conduct ###
39633

397-
[Code of Conduct](https://github.com/CoralineAda/contributor_covenant) is adapted from [Contributor Covenant, version 1.2.0](http://contributor-covenant.org/version/1/2/0/)
34+
[Code of Conduct](https://github.com/CoralineAda/contributor_covenant) is adapted from [Contributor Covenant, version 1.2.0](http://contributor-covenant.org/version/1/2/0/)

checkstyle/Checker.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Checker {
5252
}
5353

5454
public function getLinePos(off:Int):LinePos {
55+
if (off == file.content.length) off--;
5556
for (i in 0...linesIdx.length) {
5657
if (linesIdx[i].l <= off && linesIdx[i].r >= off) {
5758
return { line:i, ofs: off - linesIdx[i].l };

0 commit comments

Comments
 (0)