Skip to content

Use the ruff formatter #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1
rev: v0.1.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.10.0
hooks:
- id: black
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
hooks:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"recommendations": [
"charliermarsh.ruff",
"ms-python.black-formatter",
"ms-python.python",
"ms-python.vscode-pylance",
],
"unwantedRecommendations": [
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.isort",
]
Expand Down
6 changes: 2 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{
// Python
"python.analysis.diagnosticSeverityOverrides": {
"reportInvalidStringEscapeSequence": "warning",
"reportUnusedImport": "warning",
},
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"python.formatting.provider": "none",
"[python]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports.ruff": true,
"source.organizeImports.ruff": "explicit",
},
},
"[yaml][toml]": {
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ activated. You can also run a individual tests with `pytest -k the_name_of_your_
### Code quality

After staging your work with `git add`, you can run `pre-commit run --all-files` to run all the
code quality tools. These include [black] and [ruff] for formatting and linting, and [mypy] for
code quality tools. These include [ruff] for formatting and linting, and [mypy] for
type checking. You can also run each tool individually with `pre-commit run <tool> --all-files`.

## Creating a Pull Request
Expand All @@ -58,7 +58,6 @@ your pull request, and link it to any relevant issues or discussions.

[Discussions]: https://github.com/hamdanal/rich-argparse/discussions
[mypy]: https://mypy.readthedocs.io/en/stable/
[black]: https://black.readthedocs.io/en/stable/
[ruff]: https://beta.ruff.rs/docs/
[ruff]: https://docs.astral.sh/ruff/
[PR]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork
[venv-guide]: https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ commands =
coverage html
"""

[tool.black]
line_length = 100

[tool.ruff]
line-length = 100
select = ["E", "F", "C", "B", "UP", "RUF100", "TID"]
Expand Down