-
Notifications
You must be signed in to change notification settings - Fork 800
Introducing ruff as linter and formatter (basic setup) #2921
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 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b02d025
add ruff setup
emdneto 0affb82
fix pyproject
emdneto d3f4ce9
fix _template dir
emdneto 6e47d6a
add ruff to gen-requirements.txt
emdneto 5f38499
remove dir arg from ruff check
emdneto e152966
add all fixes from lint and format
emdneto 0fb52ac
Merge branch 'main' into ruff
emdneto d297444
run ruff for openai instrumentation
emdneto d86a452
add detect-same-package parameter to ruff
emdneto ed881d4
Merge branch 'main' into ruff
emdneto 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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,14 +1,10 @@ | ||
| repos: | ||
| - repo: https://github.com/psf/black-pre-commit-mirror | ||
| rev: 24.3.0 | ||
| hooks: | ||
| - id: black | ||
| language_version: python3.12 | ||
| - repo: https://github.com/pycqa/isort | ||
| rev: 5.12.0 | ||
| hooks: | ||
| - id: isort | ||
| - repo: https://github.com/pycqa/flake8 | ||
| rev: '6.1.0' | ||
| hooks: | ||
| - id: flake8 | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| # Ruff version. | ||
| rev: v0.6.9 | ||
| hooks: | ||
| # Run the linter. | ||
| - id: ruff | ||
| args: ["--fix", "--show-fixes"] | ||
| # Run the formatter. | ||
| - id: ruff-format |
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 |
|---|---|---|
|
|
@@ -2,8 +2,7 @@ | |
| astor==0.8.1 | ||
| jinja2==3.1.4 | ||
| markupsafe==2.0.1 | ||
| isort | ||
| black | ||
| ruff==0.6.9 | ||
| requests | ||
| tomli | ||
| tomli_w | ||
|
|
||
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,39 @@ | ||
| [tool.black] | ||
| [tool.ruff] | ||
| # https://docs.astral.sh/ruff/configuration/ | ||
| target-version = "py38" | ||
| line-length = 79 | ||
| exclude = ''' | ||
| ( | ||
| \.git | ||
| | \.tox | ||
| | venv | ||
| | build | ||
| | dist | ||
| ) | ||
| ''' | ||
| extend-exclude = [ | ||
| "_template", | ||
| "*_pb2*.py*", | ||
| ] | ||
| output-format = "concise" | ||
|
|
||
| [tool.ruff.lint] | ||
| # https://docs.astral.sh/ruff/linter/#rule-selection | ||
| # pylint: https://github.com/astral-sh/ruff/issues/970 | ||
| select = [ | ||
| "I", # isort | ||
| "F", # pyflakes | ||
| "E", # pycodestyle errors | ||
| "W", # pycodestyle warnings | ||
| "PLC", # pylint convention | ||
| "PLE", # pylint error | ||
| "Q", # flake8-quotes | ||
| "A", # flake8-builtins | ||
| ] | ||
| ignore = [ | ||
| "E501", # line-too-long | ||
| ] | ||
|
|
||
| [tool.ruff.lint.per-file-ignores] | ||
| "docs/**/*.*" = ["A001"] | ||
|
|
||
| [tool.ruff.lint.isort] | ||
| known-third-party = [ | ||
| "psutil", | ||
| "pytest", | ||
| "redis", | ||
| "redis_opentracing", | ||
| "opencensus", | ||
| ] | ||
| known-first-party = ["opentelemetry", "opentelemetry_example_app"] |
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.
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.