Total Complexity | 1 |
Total Lines | 20 |
Duplicated Lines | 0 % |
1 | import re |
||
9 | class CheckstyleBear(LocalBear, Lint): |
||
10 | executable = 'java' |
||
11 | google_checks = join(dirname(abspath(__file__)), 'google_checks.xml') |
||
12 | jar = join(dirname(abspath(__file__)), 'checkstyle.jar') |
||
13 | |||
14 | severity_map = { |
||
15 | "INFO": RESULT_SEVERITY.INFO, |
||
16 | "WARN": RESULT_SEVERITY.NORMAL} |
||
17 | |||
18 | def run(self, filename, file): |
||
19 | """ |
||
20 | Checks the code using `checkstyle` using the Google codestyle |
||
21 | specification. |
||
22 | """ |
||
23 | self.output_regex = re.compile( |
||
24 | r'\[(?P<severity>WARN|INFO)\]\s*' + abspath(filename) + |
||
25 | r':(?P<line>\d+)(:(?P<col>\d+))?:\s*' |
||
26 | r'(?P<message>.*?)\s*\[(?P<origin>[a-zA-Z]+?)\]') |
||
27 | self.arguments = '-jar ' + self.jar + ' -c ' + self.google_checks |
||
28 | return self.lint(filename) |
||
29 |