Failed Conditions
Pull Request — master (#1291)
by Sudheesh
01:38
created

bears.go.GoLintBear   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %
Metric Value
dl 0
loc 22
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 15 2
1
import re
2
3
from coalib.bearlib.abstractions.Lint import Lint
4
from coalib.bears.LocalBear import LocalBear
5
6
7
class GoLintBear(LocalBear, Lint):
8
    executable = 'golint'
9
    arguments = ('-min_confidence=0.8')
10
    output_regex = re.compile(
11
            r'(?P<path>.*?)\:(?P<line>\d+)\:(?P<column>\d+)\: (?P<message>.*)')
12
    use_stdout = True
13
14
    def run(self,
15
            filename,
16
            file,
17
            golint_cli_options: str=""):
18
        '''
19
        Checks the code using `golint`. This will run golint over each file
20
        seperately.
21
22
        :param golint_cli_options: Any other flags you wish to pass to golint
23
                                   can be passed.
24
        '''
25
        if golint_cli_options:
26
            self.arguments += " " + golint_cli_options
27
28
        return self.lint(filename)
29