Skip to content

Commit 060e100

Browse files
committed
Mention code formatting in contribution guide.
1 parent 3f7c4a2 commit 060e100

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

CONTRIBUTING.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Also, consider taking up a valuable, reviewed, but abandoned pull request which
3434
* Make sure your PR includes a [changelog fragment](https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-a-changelog-fragment).
3535
* You must not include a fragment for new modules or new plugins. Also you shouldn't include one for docs-only changes. (If you're not sure, simply don't include one, we'll tell you whether one is needed or not :) )
3636
* Please always include a link to the pull request itself, and if the PR is about an issue, also a link to the issue. Also make sure the fragment ends with a period, and begins with a lower-case letter after `-`. (Again, if you don't do this, we'll add suggestions to fix it, so don't worry too much :) )
37-
* Avoid reformatting unrelated parts of the codebase in your PR. These types of changes will likely be requested for reversion, create additional work for reviewers, and may cause approval to be delayed.
37+
* Note that we format the code with `ruff format`. If your change does not match the formatters expectations, CI will fail and your PR will not get merged. See below for how to format code with antsibull-nox.
3838

3939
You can also read [our Quick-start development guide](https://github.com/ansible/community-docs/blob/main/create_pr_quick_start_guide.rst).
4040

@@ -44,11 +44,24 @@ If you want to test a PR locally, refer to [our testing guide](https://github.co
4444

4545
If you find any inconsistencies or places in this document which can be improved, feel free to raise an issue or pull request to fix it.
4646

47-
## Run sanity or unit locally (with antsibull-nox)
47+
## Format code; and run sanity or unit tests locally (with antsibull-nox)
4848

49-
The easiest way to run sanity and unit tests locally is to use [antsibull-nox](https://ansible.readthedocs.io/projects/antsibull-nox/).
49+
The easiest way to format the code, and to run sanity and unit tests locally is to use [antsibull-nox](https://ansible.readthedocs.io/projects/antsibull-nox/).
5050
(If you have [nox](https://nox.thea.codes/en/stable/) installed, it will automatically install antsibull-nox in a virtual environment for you.)
5151

52+
### Format code
53+
54+
The following commands show how to run ansible-test sanity tests:
55+
56+
```.bash
57+
# Run all configured formatters:
58+
nox -Re formatters
59+
60+
# If you notice discrepancies between your local formatter and CI, you might
61+
# need to re-generate the virtual environment:
62+
nox -e formatters
63+
```
64+
5265
### Sanity tests
5366

5467
The following commands show how to run ansible-test sanity tests:

0 commit comments

Comments
 (0)