-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from AlessandroMiola/ruff_config
feat: add tooling (ruff, pre-commit)
- Loading branch information
Showing
5 changed files
with
330 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__pycache__ | ||
*.pyc | ||
.vscode/ | ||
.pytest_cache/ | ||
.ruff_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
default_language_version: | ||
python: python3.10 | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-toml | ||
- repo: local | ||
hooks: | ||
- id: ruff lint | ||
name: ruff (linter) | ||
entry: just ruff-fix | ||
language: system | ||
types: [python] | ||
- id: ruff format | ||
name: ruff (formatter) | ||
entry: just ruff-format | ||
language: system | ||
types: [python] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Use PowerShell instead of sh | ||
# set shell := ["powershell.exe", "-c"] | ||
|
||
help: | ||
@just --list | ||
|
||
install: | ||
@echo "🚀 Installing dependencies" | ||
@poetry install --with dev | ||
|
||
install-pre-commit: | ||
@echo "🚀 Setting up the hooks" | ||
@poetry run pre-commit install | ||
|
||
check-project: | ||
@echo "🚀 Checking consistency between poetry.lock and pyproject.toml" | ||
@poetry check --lock | ||
@echo "🚀 Running the hooks against all files" | ||
@poetry run pre-commit run --all-files | ||
|
||
ruff: | ||
@echo "🚀 Linting the project with Ruff" | ||
@poetry run ruff check . | ||
|
||
ruff-show-violations: | ||
@echo "🚀 Linting the project with Ruff and show violations" | ||
@poetry run ruff check --output-format="grouped" . | ||
|
||
ruff-fix: | ||
@echo "🚀 Linting the project with Ruff and autofix violations (where possible)" | ||
@poetry run ruff check --fix . | ||
|
||
ruff-format: | ||
@echo "🚀 Formatting the code with Ruff" | ||
@poetry run ruff format . | ||
|
||
ruff-format-check: | ||
@echo "🚀 Listing files Black would reformat" | ||
@poetry run ruff format --check . | ||
|
||
lint-and-format: ruff-fix ruff-format |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.