| Total Complexity | 3 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| 1 | import re |
||
| 8 | class RubyLintBear(LocalBear, Lint): |
||
| 9 | executable = 'ruby' |
||
| 10 | arguments = '-wc' |
||
| 11 | output_regex = re.compile( |
||
| 12 | r'(?P<file_name>.+?):(?P<line>\d+): (?P<message>' |
||
| 13 | r'(?:(?P<error>.*?error)|(?P<warning>warning))[,:] [^\r\n]+)\r?\n' |
||
| 14 | r'(?:^[^\r\n]+\r?\n^(?P<col>.*?)\^)?') |
||
| 15 | output_stream = "stderr" |
||
| 16 | |||
| 17 | @staticmethod |
||
| 18 | def _get_groupdict(match): |
||
| 19 | groups = Lint._get_groupdict(match) |
||
| 20 | if groups["error"] != None: |
||
| 21 | groups["severity"] = RESULT_SEVERITY.MAJOR |
||
| 22 | else: |
||
| 23 | groups["severity"] = RESULT_SEVERITY.NORMAL |
||
| 24 | return groups |
||
| 25 | |||
| 26 | def run(self, filename, file): |
||
| 27 | ''' |
||
| 28 | Checks the code with `ruby -wc` on each file separately. |
||
| 29 | ''' |
||
| 30 | return self.lint(filename) |
||
| 31 |