Total Complexity | 2 |
Total Lines | 23 |
Duplicated Lines | 0 % |
1 | import re |
||
9 | class ESLintBear(LocalBear, Lint): |
||
10 | executable = 'eslint' |
||
11 | arguments = '--no-ignore --no-color -f=unix' |
||
12 | output_regex = re.compile( |
||
13 | r'(?P<file>.+?)\:(?P<line>\d+)\:(?P<column>\d+)\: ' |
||
14 | r'(?P<message>.+?)\[(?P<severity>(Error|Warning))/(?P<ruleId>.+?)\]') |
||
15 | severity_map = { |
||
16 | "Error": RESULT_SEVERITY.MAJOR, |
||
17 | "Warning": RESULT_SEVERITY.NORMAL |
||
18 | } |
||
19 | |||
20 | def run(self, filename, file, eslint_config: str=""): |
||
21 | ''' |
||
22 | Checks the code with eslint. This will run eslint over each of the files |
||
23 | seperately. |
||
24 | |||
25 | :param eslint_config: The location of the .eslintrc config file. |
||
26 | ''' |
||
27 | if eslint_config: |
||
28 | self.arguments += (" --config " |
||
29 | + escape_path_argument(eslint_config)) |
||
30 | |||
31 | return self.lint(filename) |
||
32 |