-
Notifications
You must be signed in to change notification settings - Fork 32
Use ruff-format for consistent code formatting
#240
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
Open
LecrisUT
wants to merge
2
commits into
teemtee:main
Choose a base branch
from
LecrisUT:ci/ruff
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,24 +13,14 @@ repos: | |||||||||
| - --hang-closing | ||||||||||
| - --max-line-length=99 | ||||||||||
|
|
||||||||||
| - repo: https://github.com/PyCQA/isort | ||||||||||
| rev: "5.13.2" | ||||||||||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||||||||||
| rev: v0.8.6 | ||||||||||
| hooks: | ||||||||||
| - id: isort | ||||||||||
|
|
||||||||||
| - repo: https://github.com/pycqa/flake8 | ||||||||||
| rev: "7.1.1" | ||||||||||
| hooks: | ||||||||||
| - id: flake8 | ||||||||||
| - id: ruff | ||||||||||
| args: | ||||||||||
| - --max-line-length=99 | ||||||||||
| files: > | ||||||||||
| (?x)^( | ||||||||||
| bin/.*| | ||||||||||
| examples/.*| | ||||||||||
| fmf/.*| | ||||||||||
| tests/.* | ||||||||||
| )$ | ||||||||||
| - '--fix' | ||||||||||
| - '--show-fixes' | ||||||||||
| - id: ruff-format | ||||||||||
|
Comment on lines
+21
to
+23
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
|
||||||||||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||||||||||
| rev: "v5.0.0" | ||||||||||
|
|
||||||||||
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 |
|---|---|---|
|
|
@@ -61,7 +61,8 @@ platforms = ["linux"] | |
| [tool.hatch.envs.dev] | ||
| description = "Development environment" | ||
| dependencies = [ | ||
| "pytest-cov" | ||
| "pytest-cov", | ||
| "ruff", | ||
| ] | ||
| features = ["tests"] | ||
|
|
||
|
|
@@ -103,3 +104,115 @@ markers = [ | |
| testpaths = [ | ||
| 'tests', | ||
| ] | ||
|
|
||
| [tool.ruff] | ||
| line-length = 99 | ||
| src = ["fmf", "tests"] | ||
| target-version = "py39" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 99% sure ruff gets this from package metadata. |
||
|
|
||
| [tool.ruff.format] | ||
| quote-style = "preserve" | ||
| exclude = [ | ||
| "tests/*", | ||
| ] | ||
|
|
||
| [tool.ruff.lint] | ||
| select = [ | ||
| "F", # pyflakes | ||
| "E", # pycodestyle error | ||
| "W", # pycodestyle warning | ||
| "I", # isort | ||
| "N", # pep8-naming | ||
| "D", # pydocstyle | ||
| "UP", # pyupgrade | ||
| "YTT", # flake8-2020 | ||
| "ASYNC", # flake8-async | ||
| "S", # flake8-bandit | ||
| "B", # flake8-bugbear | ||
| "A", # flake8-builtins | ||
| "COM", # flake8-commas | ||
| "C4", # flake8-comprehensions | ||
| "DTZ", # flake8-datetimez | ||
| "T10", # flake8-debugger | ||
| "EXE", # flake8-executable | ||
| "ISC", # flake8-implicit-str-concat | ||
| "ICN", # flake8-import-conventions | ||
| "LOG", # flake8-logging | ||
| "G", # flake8-logging-format | ||
| "PIE", # flake8-pie | ||
| "PYI", # flake8-pyi | ||
| "PT", # flake8-pytest-style | ||
| "Q003", # avoidable-escaped-quote | ||
| "Q004", # unnecessary-escaped-quote | ||
| "RSE", # flake8-raise | ||
| "RET", # flake8-return | ||
| "SIM", # flake8-simplify | ||
| "TID", # flake8-tidy-imports | ||
| "INT", # flake8-gettext | ||
| "PGH", # pygrep-hooks | ||
| "PLC", # pylint-convention | ||
| "PLE", # pylint-error | ||
| "PLR", # pylint-refactor | ||
| "FLY", # flynt | ||
| "FURB", # refurb | ||
| "RUF", # ruff | ||
| "D", # pydocstyle | ||
| # Override docstring convention | ||
| "D213", # multi-line-summary-second-line | ||
| ] | ||
| ignore = [ | ||
| "B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... | ||
| "COM812", # Trailing comma missing | ||
| "G004", # Logging statement uses f-string | ||
| "PIE790", # Unnecessary `pass` statement | ||
| "PLC1901", # `{}` can be simplified to `{}` as an empty string is falsey | ||
| "PLE1205", # Too many arguments for `logging` format string | ||
| "PLR09", # Too many branches/statements/arguments/returns | ||
| "PLR2004", # Magic value used in comparison | ||
| "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` | ||
| "RUF013", # PEP 484 prohibits implicit `Optional` | ||
| # flake8-bandit (S) https://docs.astral.sh/ruff/rules/#flake8-bandit-s | ||
| "S101", # Use of `assert` detected | ||
| "S603", # `subprocess` call: check for execution of untrusted input | ||
| "S607", # Starting a process with a partial executable path | ||
| "S105", # Possible hardcoded password assigned to: "PASS" | ||
| "SIM103", # Return the condition directly - can hurt readability | ||
| "D200", # One-line docstring should fit on one line | ||
| "D212", # Multi-line docstring summary should start at the first line | ||
|
|
||
| # pydocstyle | ||
| # TODO: the permanent list (drop this comment once the temporary list | ||
| # below gets to zero items...) | ||
| "D203", # 1 blank line required before class docstring | ||
| # TODO: the temporary list - some of these will be enabled in their | ||
| # own patches | ||
| "D100", # Missing docstring in public module | ||
| "D101", # Missing docstring in public class | ||
| "D102", # Missing docstring in public method | ||
| "D103", # Missing docstring in public function | ||
| "D104", # Missing docstring in public package | ||
| "D105", # Missing docstring in magic method | ||
| "D106", # Missing docstring in public nested class | ||
| "D107", # Missing docstring in __init__ | ||
| "D202", # No blank lines allowed after function docstring | ||
| "D205", # 1 blank line required between summary line and description | ||
| "D301", # Use r""" if any backslashes in a docstring | ||
| "D400", # First line should end with a period | ||
| "D401", # First line of docstring should be in imperative mood | ||
| "D415", # First line should end with a period, question mark, or exclamation point | ||
| ] | ||
|
|
||
| [tool.ruff.lint.flake8-bugbear] | ||
| extend-immutable-calls = ["tmt.utils.field"] | ||
|
|
||
| [tool.ruff.lint.pydocstyle] | ||
| # "The PEP 257 convention includes all D errors apart from: D203, D212, | ||
| # D213, D214, D215, D404, D405, D406, D407, D408, D409, D410, D411, D413, | ||
| # D415, D416, and D417." | ||
| # | ||
| # See https://docs.astral.sh/ruff/faq/#does-ruff-support-numpy-or-google-style-docstrings for | ||
| # the most up-to-date info. | ||
| convention = "pep257" | ||
|
|
||
| [tool.ruff.lint.isort] | ||
| known-first-party = ["fmf"] | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably only want to deal with formatting as part of this PR?