Original Author: Josh Wilson (@person142) Source: https://github.com/scipy/scipy/blob/main/tools/lint_diff.py Unlike pycodestyle, ruff by itself is not capable of limiting its output to the given diff.
(self, fix: bool)
| 11 | self.repository_root = os.path.realpath(os.path.join(CWD, "..")) |
| 12 | |
| 13 | def run_ruff(self, fix: bool) -> tuple[int, str]: |
| 14 | """ |
| 15 | Original Author: Josh Wilson (@person142) |
| 16 | Source: |
| 17 | https://github.com/scipy/scipy/blob/main/tools/lint_diff.py |
| 18 | Unlike pycodestyle, ruff by itself is not capable of limiting |
| 19 | its output to the given diff. |
| 20 | """ |
| 21 | print("Running Ruff Check...") |
| 22 | command = ["ruff", "check"] |
| 23 | if fix: |
| 24 | command.append("--fix") |
| 25 | |
| 26 | res = subprocess.run( |
| 27 | command, |
| 28 | stdout=subprocess.PIPE, |
| 29 | cwd=self.repository_root, |
| 30 | encoding="utf-8", |
| 31 | ) |
| 32 | return res.returncode, res.stdout |
| 33 | |
| 34 | def run_cython_lint(self) -> tuple[int, str]: |
| 35 | print("Running cython-lint...") |