Add docs spelling check

* Add codespell config to noxfile and ci
* Update README with details on spelling checks

Co-authored-by: Maxwell G <9920591+gotmax23@users.noreply.github.com>
This commit is contained in:
Don Naro
2023-10-10 10:51:11 +01:00
parent b9323fbe54
commit b8553c22ce
9 changed files with 74 additions and 0 deletions

15
.codespellignorelines Normal file
View File

@@ -0,0 +1,15 @@
# This file contains exact lines ignored by the spelling check.
$ ssh-add ~/.ssh/keypair.pem
shell: echo "disable server myapplb/{{ inventory_hostname }}" | socat stdio /var/lib/haproxy/stats
shell: echo "enable server myapplb/{{ inventory_hostname }}" | socat stdio /var/lib/haproxy/stats
"ro": true,
"options": "ro,relatime,mode=0700",
RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
IAM policies for AWS
for managing IAM roles, users and groups.
see the `Active Directory Certificate Services documentation <https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc732625(v=ws.11)>`_.
`Act as part of the operating system <https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/dn221957(v=ws.11)>`_.
`Accounts: Limit local account use of blank passwords to console logon only <https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj852174(v=ws.11)>`_
role_type: ANS
# => "$6$43927$lQxPKz2M2X.NWO.gK.t7phLwOKQMcSq72XxDZQ0XzYV6DlL1OD72h417aj16OnHTGxNzhftXJQBcjbunLEepM0"
table#network-platform-table thead tr th.head {

4
.codespellignorewords Normal file
View File

@@ -0,0 +1,4 @@
# This file contains words ignored by the spelling check.
aci
falsy
doas

8
.codespellrc Normal file
View File

@@ -0,0 +1,8 @@
[codespell]
skip = _build,collections,*.po,_static,porting_guide*,style_guide
count =
check-filenames = true
quiet-level = 3
ignore-words = .codespellignorewords
exclude-file = .codespellignorelines
builtin = clear,code,en-GB_to_en-US,informal,names,rare

View File

@@ -39,4 +39,5 @@ jobs:
-e 'pip-compile-3.10(formatters)'
'pip-compile-3.10(typing)'
'pip-compile-3.10(static)'
'pip-compile-3.10(spelling)'
reset-branch: "${{ inputs.reset-branch || false }}"

View File

@@ -17,6 +17,8 @@ jobs:
python-versions: "3.11"
- session: typing
python-versions: "3.11"
- session: spelling
python-versions: "3.11"
name: "Run nox ${{ matrix.session }} session"
steps:
- name: Check out repo

View File

@@ -8,6 +8,27 @@ This repository holds the ReStructuredText (RST) source, and other files, for us
Follow the documentation to [set up your environment](https://docs.ansible.com/ansible/latest/community/documentation_contributions.html#setting-up-your-environment-to-build-documentation-locally) and then [build Ansible community documentation locally](https://docs.ansible.com/ansible/latest/community/documentation_contributions.html#building-the-documentation-locally)
## Using nox
This project includes a `nox` configuration to automate checks and other functions.
You should use `nox` to run checks locally before you submit a pull request.
Install `nox` using `python3 -m pip install nox` or your distribution's package manager.
Run `nox --list` from the repository root to view available sessions.
Run `nox` with no arguments to execute the default sessions.
## Running the spelling check
This repository uses [`codespell`](https://github.com/codespell-project/codespell) to check for common spelling mistakes in the documentation source.
Run `nox -s spelling` to check spelling.
Run `nox -s spelling -- -w` to correct spelling errors.
When `codespell` suggests more than one word as a correction, run `nox -s spelling -- -w -i 3` to select an option.
## Updating the dependencies
To update dependencies, you can use `nox -e pip-compile`. Since this requires Python 3.10, this might not work in your environment if you do not have Python 3.10 installed. In that case, you can use root-less podman with a Python 3.10 image:

View File

@@ -56,11 +56,25 @@ def typing(session: nox.Session):
session.run("mypy", *session.posargs, *LINT_FILES)
@nox.session
def spelling(session: nox.Session):
"""
Spell check RST documentation
"""
install(session, req="spelling")
session.run(
"codespell",
"docs/docsite",
*session.posargs,
)
@nox.session
def lint(session: nox.Session):
session.notify("typing")
session.notify("static")
session.notify("formatters")
session.notify("spelling")
requirements_files = list(

1
tests/spelling.in Normal file
View File

@@ -0,0 +1 @@
codespell

8
tests/spelling.txt Normal file
View File

@@ -0,0 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe --output-file=tests/spelling.txt --strip-extras tests/spelling.in
#
codespell==2.2.6
# via -r tests/spelling.in