Skip to content

Commit

Permalink
replaced all docs refs of 'black' to 'ruff'
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Chan committed Feb 9, 2024
1 parent 1fedbcd commit 16b3571
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
# Common links that should be available on every page
rst_epilog = """
.. _Diamond Light Source: http://www.diamond.ac.uk
.. _black: https://github.com/psf/black
.. _ruff: https://github.com/astral-sh/ruff
.. _flake8: https://flake8.pycqa.org/en/latest/
.. _isort: https://github.com/PyCQA/isort
.. _pyright: https://microsoft.github.io/pyright/#/
Expand Down
16 changes: 8 additions & 8 deletions docs/explanations/decisions/0008-use-tox.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ against the changes you are about to commit.
There are a number of things that CI needs to run:

- pytest
- black
- ruff
- pyright
- flake8
- isort
Expand All @@ -44,7 +44,7 @@ under pytest that had a plugin, and isort under flake8:
subgraph cluster_0 {
label = "pytest"
"pytest-black"
"pytest-ruff"
"pytest-pyright"
subgraph cluster_1 {
label = "pytest-flake8"
Expand All @@ -68,15 +68,15 @@ To address this, the tree was rearranged:
node [fontname="Lato" fontsize=10 shape=box style=filled fillcolor="#8BC4E9"]
pytest
black
ruff
pyright
subgraph cluster_1 {
label = "flake8"
"flake8-isort"
}
```

If using VSCode, this will still run black, flake8 and pyright on file save, but
If using VSCode, this will still run ruff, flake8 and pyright on file save, but
for those using other editors and for CI another solution was needed. Enter
[pre-commit](https://pre-commit.com/). This allows hooks to be run at `git
commit` time on just the files that have changed, as well as on all tracked
Expand Down Expand Up @@ -113,7 +113,7 @@ The graph now looks like:
"sphinx-build"
subgraph cluster_1 {
label = "pre-commit"
black
ruff
subgraph cluster_2 {
label = "flake8"
"flake8-isort"
Expand All @@ -124,11 +124,11 @@ The graph now looks like:

Now the workflow looks like this:

- Save file, VSCode runs black, flake8 and pyright on it
- Save file, VSCode runs ruff, flake8 and pyright on it
- Run 'tox -p' and fix issues until it succeeds
- Commit files and pre-commit runs black and flake8 on them (if the
- Commit files and pre-commit runs ruff and flake8 on them (if the
developer had not run tox then this catches some of the most common issues)
- Push to remote and CI runs black, flake8, pyright once on all files
- Push to remote and CI runs ruff, flake8, pyright once on all files
(using tox), then pytest multiple times in a test matrix

## Consequences
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Code Standards

The code in this repository conforms to standards set by the following tools:

- black_ for code formatting
- ruff_ for code formatting
- flake8_ for style checks
- isort_ for import ordering
- pyright_ for static type checking
Expand Down
2 changes: 1 addition & 1 deletion template/{% if sphinx %}docs{% endif %}/conf.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ inheritance_graph_attrs = {"rankdir": "TB"}
# Common links that should be available on every page
rst_epilog = """
.. _Diamond Light Source: http://www.diamond.ac.uk
.. _black: https://github.com/psf/black
.. _ruff: https://github.com/astral-sh/ruff
.. _ruff: https://beta.ruff.rs/docs/
.. _pyright: https://microsoft.github.io/pyright/#/
.. _pre-commit: https://pre-commit.com/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Run linting using pre-commit
============================

Code linting is handled by black_ and ruff_ run under pre-commit_.
Code linting is handled by ruff_ run under pre-commit_.

Running pre-commit
------------------
Expand All @@ -21,19 +21,14 @@ This will result in pre-commits being enabled on every repo your user clones fro
Fixing issues
-------------

If black reports an issue you can tell it to reformat all the files in the
If ruff reports an issue you can tell it to reformat all the files in the
repository::

$ black .

Likewise with ruff::

$ ruff --fix .

Ruff may not be able to automatically fix all issues; in this case, you will have to fix those manually.

VSCode support
--------------

The ``.vscode/settings.json`` will run black formatting as well as
ruff checking on save. Issues will be highlighted in the editor window.
The ``.vscode/settings.json`` will run ruff checking on save. Issues will be highlighted in the editor window.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Code Standards

The code in this repository conforms to standards set by the following tools:

- black_ for code formatting
- ruff_ for style checks
- pyright_ for static type checking

Expand Down

0 comments on commit 16b3571

Please sign in to comment.