Skip to content

Commit

Permalink
docs: Update docs (flake8 -> ruff)
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Nov 30, 2023
1 parent f9de5ac commit 6b3da9c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 50 deletions.
30 changes: 0 additions & 30 deletions docs/migrate.md

This file was deleted.

4 changes: 2 additions & 2 deletions docs/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export PYENV_ROOT="${HOME}/.pyenv"
eval "$(pyenv init -)"

# install Python 3
pyenv install 3.8.6
pyenv install 3.11.6

# make it available globally
pyenv global system 3.8.6
pyenv global 3.11.6

# finally, restart your shell
# to make sure your environment is up-to-date
Expand Down
31 changes: 14 additions & 17 deletions docs/work.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,8 @@ run `make check-types`.
### check-quality
The code quality analysis is done
with [Flake8](https://flake8.pycqa.org/en/latest/),
and a battery of Flake8 plugins.
The analysis is configured in `config/flake8.ini`.
with [Ruff](https://github.com/astral-sh/ruff).
The analysis is configured in `config/ruff.toml`.
In this file, you can deactivate rules
or activate others to customize your analysis.
Rules identifiers always start with one or more capital letters,
Expand All @@ -305,7 +304,7 @@ You can ignore a rule on a specific code line by appending
a `noqa` comment ("no quality analysis/assurance"):
```python title="src/your_package/module.py"
print("a code line that triggers a flake8 warning") # noqa: ID
print("a code line that triggers a Ruff warning") # noqa: ID
```
...where ID is the identifier of the rule you want to ignore for this line.
Expand All @@ -319,17 +318,14 @@ import subprocess
```console
$ make check-quality
✗ Checking code quality (1)
> flake8 --config=config/flake8.ini src/ tests/ scripts/
> ruff check --config=config/ruff.toml src/ tests/ scripts/
src/your_package/module.py:2:1: S404 Consider possible security implications associated with subprocess module.
```
Now add a comment to ignore this warning.
As a best-practice, and because rules identifiers
are not self-explanatory, add a comment explaining
why we ignore the warning:
```python title="src/your_package/module.py"
import subprocess # noqa: S404 (we don't mind the security implications)
import subprocess # noqa: S404
```
```console
Expand All @@ -349,18 +345,19 @@ markdown_docstring = """
print("code block")
\"\"\"
```
""" # noqa: D300,D301 (escape sequences: it's not a regex)
""" # noqa: D300,D301
```
You can disable a warning globally by adding its ID
into the list in `pyproject.toml`, section `[tool.flakehell.plugins]`.
into the list in `config/ruff.toml`.
You can also disable warnings per file, like so:
```ini title="config/flake8.ini"
per-file-ignores =
# mutable constant
src/your_package/your_module.py:WPS407
```toml title="config/ruff.toml"
[per-file-ignores]
"src/your_package/your_module.py" = [
"T201", # Print statement
]
```
### check-dependencies
Expand Down Expand Up @@ -595,14 +592,14 @@ release this exact same version with `make release version=0.5.1`.
The `release` action does several things, in this order:
- Update the version in `pyproject.toml`
- Stage the modified files (`pyproject.toml` and `CHANGELOG.md `)
- Stage the changelog file (`CHANGELOG.md`)
- Commit the changes with a message like `chore: Prepare release 0.5.1`
- Tag the commit with that version
- Push the commits
- Push the tags
- Build the package dist and wheel
- Publish the dist and wheel to PyPI.org
- Build and deploy the documentation site
## Documentation
Expand Down
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ nav:
- Generating a project: generate.md
- Working on a project: work.md
- Updating a project: update.md
- Migrating from copier-poetry: migrate.md
- Author's website: https://pawamoy.github.io/

theme:
Expand Down

0 comments on commit 6b3da9c

Please sign in to comment.