| Total Complexity | 2 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| 1 | import re |
||
| 8 | class PerlCriticBear(LocalBear, Lint): |
||
| 9 | executable = 'perlcritic' |
||
| 10 | arguments = '--no-color --verbose "%l|%c|%s|%p|%m (%e)"' |
||
| 11 | output_regex = re.compile( |
||
| 12 | r'(?P<line>\d+)\|(?P<column>\d+)\|(?P<severity>\d+)\|' |
||
| 13 | r'(?P<origin>.*?)\|(?P<message>.*)') |
||
| 14 | |||
| 15 | def run(self, |
||
| 16 | filename, |
||
| 17 | file, |
||
| 18 | perlcritic_config: str=""): |
||
| 19 | ''' |
||
| 20 | Checks the code with perlcritic. This will run perlcritic over |
||
| 21 | each of the files seperately |
||
| 22 | |||
| 23 | :param perlcritic_config: Location of the perlcriticrc config file. |
||
| 24 | ''' |
||
| 25 | |||
| 26 | if perlcritic_config: |
||
| 27 | self.arguments += (" --config " |
||
| 28 | + escape_path_argument(perlcritic_config)) |
||
| 29 | |||
| 30 | return self.lint(filename) |
||
| 31 |