You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/linting.md
+16-34Lines changed: 16 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -5,43 +5,25 @@ layout: default
5
5
6
6
# Linting
7
7
8
-
See [here for example configuration](https://github.com/UCL-ARC/python-tooling/blob/main/%7B%7Bcookiecutter.project_slug%7D%7D/.pre-commit-config.yaml) for some of these.
8
+
See [here for an example configuration](https://github.com/UCL-ARC/python-tooling/blob/main/%7B%7Bcookiecutter.project_slug%7D%7D/.pre-commit-config.yaml) for some of these.
|[ruff-format](https://github.com/astral-sh/ruff)| Like `black` but super fast. | 🟢 ||
15
-
|[isort](https://pycqa.github.io/isort/)| Sorts imports alphabetically, splits into first/third party, works on python & cython code. | 🟢 ||
16
-
|[pre-commit](https://pre-commit.com/)| Universal tool which performs a git hook on commit, allows you to run linters/formatters on any code. A tool to automatically run many of the tools listed below. | 🟢 |[DiRAC](https://github.com/UCL-ARC/dirac-swift-api), [RRED](https://github.com/UCL-ARC/rred-reports), [Crabs Exploration](https://github.com/SainsburyWellcomeCentre/crabs-exploration)|
17
-
|[ruff](https://github.com/astral-sh/ruff)| A very fast linter which incorporates a range of other linters. | 🟢 |[DiRAC](https://github.com/UCL-ARC/dirac-swift-api), [RRED](https://github.com/UCL-ARC/rred-reports), [Crabs Exploration](https://github.com/SainsburyWellcomeCentre/crabs-exploration)|
18
-
|[toml-sort](https://toml-sort.readthedocs.io/en/latest/)| Sorts TOML files which are now part of PEP 8. | 🟢 ||
19
-
|[black](https://black.readthedocs.io/en/stable/)| Opinionated formatter, defaults to 88 characters per line. | 🟠 |[DiRAC](https://github.com/UCL-ARC/dirac-swift-api), [Crabs Exploration](https://github.com/SainsburyWellcomeCentre/crabs-exploration), [autodE](https://github.com/duartegroup/autodE)|
20
-
|[autopep8](https://github.com/hhatto/autopep8)| Formatter which conforms to PEP 8. | 🟠 ||
21
-
|[pycodestyle](https://pycodestyle.pycqa.org/en/latest/)| Linter which checks for errors. | 🟠 ||
22
-
|[pyflakes](https://github.com/PyCQA/pyflakes)| Linter which checks for errors. | 🟠 ||
23
-
|[pylint](https://pylint.readthedocs.io/en/latest/)| Linter which checks for errors. | 🟠 ||
24
-
|[sourcery](https://sourcery.ai/)| An AI code reviewer which simplifies code, has a free version but can pay for fancier features. | 🟠 ||
25
-
|[yapf](https://github.com/google/yapf)| Google formatter. | 🟠 ||
26
-
|[flake8](https://flake8.pycqa.org/en/latest/)| Linter which complains if code doesn't follow a rule. Does not support modern `pyproject.toml` configuration. | 🔴 ||
27
-
28
-
<details>
29
-
<summary> 🟢 explanation</summary>
30
-
31
-
We recommend a suite of 🟢 tools that we've used and work well together.
32
-
33
-
- Pre-commit is a useful framework tool to list several linters and run it automatically. It can be used to run all of our recommended linters.
34
-
35
-
-`black` is a nice _"no need to think"_ code formatter. If you have your own opinions about code style you might not like this. But it's widely used by almost all ARC python projects.
36
-
37
-
</details>
38
-
39
-
<details>
40
-
<summary> 🔴 explanation</summary>
41
-
42
-
Flake8 is not recommended because it doesn't support `pyproject.toml` and [seemingly won't](https://github.com/PyCQA/flake8/issues/234#issuecomment-1206730688). There are now better and more flexible tools available.
|[pre-commit](https://pre-commit.com/)| Universal tool which performs a git hook on commit, allows you to run linters/formatters on any code. A tool to automatically run many of the tools listed below. | 🟢 |[DiRAC](https://github.com/UCL-ARC/dirac-swift-api), [RRED](https://github.com/UCL-ARC/rred-reports), [Crabs Exploration](https://github.com/SainsburyWellcomeCentre/crabs-exploration)|
15
+
|[ruff-format](https://github.com/astral-sh/ruff)| A drop-in replacement for `black` (and also super fast). A nice "no-need to think" code formatter. If you have your own opinions about code style, you might not like this. | 🟢 ||
16
+
|[ruff](https://github.com/astral-sh/ruff)| A fast linter which incorporates a range of other linters. Notably [isort](https://pycqa.github.io/isort/) can be included as a [ruff rule](https://docs.astral.sh/ruff/rules/) (which we recommend). | 🟢 |[DiRAC](https://github.com/UCL-ARC/dirac-swift-api), [RRED](https://github.com/UCL-ARC/rred-reports), [Crabs Exploration](https://github.com/SainsburyWellcomeCentre/crabs-exploration)|
17
+
|[toml-sort](https://toml-sort.readthedocs.io/en/latest/)| Sorts TOML files which are now part of PEP 8. | 🟢 ||
18
+
|[autopep8](https://github.com/hhatto/autopep8)| Formatter which conforms to PEP 8. | 🟠 ||
19
+
|[black](https://black.readthedocs.io/en/stable/)| Opinionated formatter, defaults to 88 characters per line. Widely used, but we now recommend `ruff-format` in its place. | 🟠 |[DiRAC](https://github.com/UCL-ARC/dirac-swift-api), [Crabs Exploration](https://github.com/SainsburyWellcomeCentre/crabs-exploration), [autodE](https://github.com/duartegroup/autodE)|
20
+
|[isort](https://pycqa.github.io/isort/)| Sorts imports alphabetically, splits into first/third party, works on python & cython code. We recommend this, but it can be included in `ruff`, which is simpler. | 🟠 ||
21
+
|[pycodestyle](https://pycodestyle.pycqa.org/en/latest/)| Linter which checks for errors. | 🟠 ||
22
+
|[pyflakes](https://github.com/PyCQA/pyflakes)| Linter which checks for errors. | 🟠 ||
23
+
|[pylint](https://pylint.readthedocs.io/en/latest/)| Linter which checks for errors. | 🟠 ||
24
+
|[sourcery](https://sourcery.ai/)| An AI code reviewer which simplifies code, has a free version but can pay for fancier features. | 🟠 ||
25
+
|[yapf](https://github.com/google/yapf)| Google formatter. | 🟠 ||
26
+
|[flake8](https://flake8.pycqa.org/en/latest/)| Linter which complains if code doesn't follow a rule. Does not support modern `pyproject.toml` configuration. | 🔴 ||
0 commit comments