-
Notifications
You must be signed in to change notification settings - Fork 4
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
chore: Switch to Ruff #112
Merged
Merged
Conversation
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #112 +/- ##
==========================================
+ Coverage 94.01% 94.04% +0.03%
==========================================
Files 2 2
Lines 167 168 +1
Branches 43 43
==========================================
+ Hits 157 158 +1
Misses 4 4
Partials 6 6 ☔ View full report in Codecov by Sentry. |
jmgate
force-pushed
the
switch-to-ruff
branch
14 times, most recently
from
April 22, 2024 21:46
e7b5af8
to
eed88f8
Compare
Use Ruff to replace a variety of linters/formatters.
Running `flake8-datetimez` via Ruff yielded the following findings: example/test_examples.py:88:25: DTZ005 `datetime.datetime.now()` called without a `tz` argument example/test_examples.py:89:25: DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z example/test_examples.py:125:13: DTZ005 `datetime.datetime.now()` called without a `tz` argument example/test_examples.py:126:25: DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z Found 4 errors. Specifying timezone info resolves the issues.
Running `flake8-errmsg` via Ruff yielded the following findings: reverse_argparse/reverse_argparse.py:143:17: EM102 Exception must not use an f-string literal, assign to variable first reverse_argparse/reverse_argparse.py:461:17: EM102 Exception must not use an f-string literal, assign to variable first Found 2 errors. This changes resolves the issues.
Turning on `flake8-boolean-trap` linting via Ruff resulted in the following findings: reverse_argparse/reverse_argparse.py:242:31: FBT002 Boolean default positional argument in function definition reverse_argparse/reverse_argparse.py:242:31: FBT001 Boolean-typed positional argument in function definition Found 2 errors. Switching `prefer_short` from a positional to a keyword-only argument addresses the problem. Note that this is technically a breaking change, but only for a "private" method, not in the package's public API. Therefore the change is not registered as a breaking change via Conventional Commit syntax, and no major version update will be created. Instead, this commit will force the creation of a patch release. If users were relying on the prior behavior of this internal method, they can simply switch to the keyword syntax when calling it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Type: Task
Description
Use Ruff to replace a variety of linters and formatters. Also turn on many of the linters Ruff adds over our prior configuration, and address any findings.
Related Issues/PRs
Closes #56.
Commits
chore: Switch to Ruff (6112943)
Use Ruff to replace a variety of linters/formatters.
docs: Add docstrings to test/example files (f0b7eb9)
chore: Ignore security findings in tests/examples (f18ece4)
refactor: Don't override Python builtins (9006adb)
test: Use UTC timezone with datetime (25ff30f)
Running
flake8-datetimez
via Ruff yielded the following findings:Specifying timezone info resolves the issues.
refactor: Assign exception messages to variables (844c71a)
Running
flake8-errmsg
via Ruff yielded the following findings:This change resolves the issues.
refactor: Remove unnecessary shebang lines (a7ae1f6)
test: Use tuples for parametrize variables (25d9be8)
refactor: Ignore particular type error (9d412dd)
refactor: Address Pylint findings (862bc62)
refactor: Address Ruff-specific lint findings (076e199)
patch: Force
prefer_short
to be keyword-only (f02c7f2)Turning on
flake8-boolean-trap
linting via Ruff resulted in the following findings:Switching
prefer_short
from a positional to a keyword-only argument addresses the problem.Note that this is technically a breaking change, but only for a "private" method, not in the package's public API. Therefore the change is not registered as a breaking change via Conventional Commit syntax, and no major version update will be created. Instead, this commit will force the creation of a patch release. If users were relying on the prior behavior of this internal method, they can simply switch to the keyword syntax when calling it.