Skip to content

Commit

Permalink
Ensure Ruff checks formatting during CI checks (#342)
Browse files Browse the repository at this point in the history
* Ensure make test runs ruff format --check

* Update ruff extension cfg

- The VSCode ruff extension will no longer
automatically remove unused imports but will still
notify you they're incorrect
- Updated ruff to 0.8.2
  • Loading branch information
whabanks authored Dec 13, 2024
1 parent b3085f8 commit 568d873
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 34 deletions.
33 changes: 21 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,27 @@
"containerEnv": {
"SHELL": "/bin/zsh"
},
"settings": {
"python.linting.": true,
"python.pythonPath": "/usr/local/bin/python",
"customizations": {
"vscode": {
"extensions": [
"donjayamanne.python-extension-pack",
"ms-python.python",
"ms-python.vscode-pylance",
"eamodio.gitlens",
"GitHub.copilot",
"tamasfe.even-better-toml",
"charliermarsh.ruff",
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"ruff.lint.ignore": ["F401"],
"ruff.lint.run": "onSave",
"ruff.organizeImports": false,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
}
},
"extensions": [
"donjayamanne.python-extension-pack",
"ms-python.python",
"ms-python.vscode-pylance",
"eamodio.gitlens",
"GitHub.copilot",
"tamasfe.even-better-toml",
"charliermarsh.ruff",
],
"postCreateCommand": "notify-dev-entrypoint.sh",
}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ clean-docker-containers: ## Clean up any remaining docker containers

.PHONY: format
format:
ruff check --select I --fix .
ruff format .
ruff check --fix .
ruff check
ruff format .
poetry run mypy .
poetry sort

Expand Down
38 changes: 19 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pytest-cov = "2.12.1"
pytest-mock = "3.14.0"
pytest-xdist = "2.5.0"
requests-mock = "1.12.1"
ruff = "^0.6.0"
ruff = "^0.8.2"
types-beautifulsoup4 = "^4.12.0.20240229"
types-bleach = "5.0.3.1"
types-cachetools = "5.5.0.20240820"
Expand Down
3 changes: 3 additions & 0 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ display_result $? 1 "Code style check"
ruff check --select I .
display_result $? 1 "Import order check"

ruff format --check .
display_result $? 1 "Code format check"

mypy .
display_result $? 1 "Static type check"

Expand Down

0 comments on commit 568d873

Please sign in to comment.