Completed
Pull Request — master (#1530)
by Abdeali
01:53
created

bears.latex.LatexLintBear   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %
Metric Value
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 5 1
1
import re
2
3
from coalib.bearlib.abstractions.Lint import Lint
4
from coalib.bears.LocalBear import LocalBear
5
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
6
7
8
class LatexLintBear(LocalBear, Lint):
9
    executable = 'chktex'
10
    output_regex = re.compile(r'(?P<severity>Error|Warning) (?P<num>[0-9]+)'
11
                              r' in (?P<file_name>\S+) line (?P<line>[0-9]+)'
12
                              r': (?P<message>.*)')
13
    severity_map = {'Warning': RESULT_SEVERITY.NORMAL,
14
                    'Error': RESULT_SEVERITY.MAJOR}
15
16
    def run(self, filename, file):
17
        '''
18
        Checks the code with `chktex`.
19
        '''
20
        return self.lint(filename)
21