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

bears.latex.LatexLintBear.run()   A

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 5
rs 9.4285
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