Completed
Pull Request — master (#1106)
by Lasse
02:11
created

bears.c_languages.IndentBear   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %
Metric Value
dl 0
loc 21
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 17 2
1
import platform
2
from bears.linters.CorrectionBasedBear import CorrectionBasedBear
3
4
5
class IndentBear(CorrectionBasedBear):
6
    BINARY = "indent" if platform.system() != "Darwin" else "gindent"
7
    RESULT_MESSAGE = "Indentation can be improved."
8
9
    def run(self,
10
            filename,
11
            file,
12
            indent_cli_options: str='--k-and-r-style'):
13
        """
14
        This bear checks and corrects spacing and indentation via the well
15
        known Indent utility. It is designed to work with the C programming
16
        language but may work reasonably with syntactically similar languages.
17
18
        :param indent_cli_options: Any command line options the indent binary
19
                                   understands. They will be simply passed
20
                                   through.
21
        """
22
        for result in self.retrieve_results(filename,
23
                                            file,
24
                                            cli_options=indent_cli_options):
25
            yield result
26