| Conditions | 3 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | import platform |
||
| 11 | def run(self, |
||
| 12 | filename, |
||
| 13 | file, |
||
| 14 | max_line_length: int=80, |
||
| 15 | use_spaces: bool=True, |
||
| 16 | tab_width: int=SpacingHelper.DEFAULT_TAB_WIDTH, |
||
| 17 | indent_cli_options: str=''): |
||
| 18 | """ |
||
| 19 | This bear checks and corrects spacing and indentation via the well |
||
| 20 | known Indent utility. It is designed to work with the C programming |
||
| 21 | language but may work reasonably with syntactically similar languages. |
||
| 22 | |||
| 23 | :param max_line_length: Maximum number of characters for a line. |
||
| 24 | :param use_spaces: True if spaces are to be used, else tabs. |
||
| 25 | :param tab_width: Number of spaces per indent level. |
||
| 26 | :param indent_cli_options: Any command line options the indent binary |
||
| 27 | understands. They will be simply passed |
||
| 28 | through. |
||
| 29 | """ |
||
| 30 | options = "--no-tabs" if use_spaces else "--use-tabs" |
||
| 31 | options += (" --line-length {0} --indent-level {1} --tab-size {1} " |
||
| 32 | "{2}".format(max_line_length, |
||
| 33 | tab_width, |
||
| 34 | indent_cli_options)) |
||
| 35 | for result in self.retrieve_results(filename, |
||
| 36 | file, |
||
| 37 | cli_options=options): |
||
| 38 | yield result |
||
| 39 |