-
Notifications
You must be signed in to change notification settings - Fork 112
Use ruff for pre-commit checks; replaces isort and flake8 #549
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
94937c8
Use ruff for pre-commit checks; replaces isort and flake8
jpolchlo 105d385
Update changelog to include link to this PR
jpolchlo 1e2dffd
Merge branch 'main' into feature/ruff
gadomski bfe8749
feat: switch to ruff
gadomski c809590
feat: apply formatting changes
gadomski 50c83ad
deps: pre-commit autoupdate
gadomski a9fdb87
fixup some black formatting
gadomski efa6728
fixup, docs: changelog
gadomski ae802a6
fix: add I to ruff rules
gadomski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -1,54 +1,10 @@ | ||
repos: | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.12.0 | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: "v0.0.267" | ||
hooks: | ||
- id: isort | ||
language_version: python3.8 | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
- repo: https://github.com/psf/black | ||
rev: 22.12.0 | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
args: ["--safe"] | ||
language_version: python3.8 | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.0.0 | ||
hooks: | ||
- id: flake8 | ||
language_version: python3.8 | ||
args: [ | ||
# E501 let black handle all line length decisions | ||
# W503 black conflicts with "line break before operator" rule | ||
# E203 black conflicts with "whitespace before ':'" rule | ||
"--ignore=E501,W503,E203,C901", | ||
] | ||
- repo: https://github.com/chewse/pre-commit-mirrors-pydocstyle | ||
# 2.1.1 | ||
rev: v2.1.1 | ||
hooks: | ||
- id: pydocstyle | ||
language_version: python3.8 | ||
exclude: ".*(test|alembic|scripts).*" | ||
args: | ||
[ | ||
# Check for docstring presence only | ||
"--select=D1", | ||
] | ||
# Don't require docstrings for tests | ||
# '--match=(?!test).*\.py'] | ||
# - | ||
# repo: https://github.com/pre-commit/mirrors-mypy | ||
# rev: v0.770 | ||
# hooks: | ||
# - id: mypy | ||
# language_version: python3.8 | ||
# args: [--no-strict-optional, --ignore-missing-imports] | ||
- repo: https://github.com/PyCQA/pydocstyle | ||
rev: 6.3.0 | ||
hooks: | ||
- id: pydocstyle | ||
language_version: python3.8 | ||
exclude: ".*(test|alembic|scripts).*" | ||
#args: [ | ||
# Don't require docstrings for tests | ||
#'--match=(?!test|alembic|scripts).*\.py', | ||
#] |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -1,11 +1,21 @@ | ||
[flake8] | ||
ignore = "D203" | ||
exclude = [".git", "__pycache__", "docs/source/conf.py", "build", "dist"] | ||
max-complexity = 12 | ||
max-line-length = 90 | ||
[tool.ruff] | ||
line-length = 90 | ||
select = [ | ||
"C9", | ||
"D1", | ||
"E", | ||
"F", | ||
"I", | ||
"W", | ||
] | ||
gadomski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
[tool.isort] | ||
profile = "black" | ||
known_first_party = "stac_fastapi" | ||
known_third_party = ["stac-pydantic", "fastapi"] | ||
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] | ||
[tool.ruff.per-file-ignores] | ||
"**/tests/**/*.py" = ["D1"] | ||
|
||
[tool.ruff.isort] | ||
known-first-party = ["stac_fastapi"] | ||
known-third-party = ["stac_pydantic", "fastapi"] | ||
section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"] | ||
|
||
[tool.black] | ||
target-version = ["py38", "py39", "py310", "py311"] |
This file contains hidden or 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 |
---|---|---|
@@ -1 +1 @@ | ||
"""api submodule.""" | ||
"""Api submodule.""" |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"""library version.""" | ||
"""Library version.""" | ||
__version__ = "2.4.6" |
This file contains hidden or 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 |
---|---|---|
@@ -1 +1 @@ | ||
"""extensions submodule.""" | ||
"""Extensions submodule.""" |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.