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