-
Notifications
You must be signed in to change notification settings - Fork 12
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
Ruff rules: Stricter code quality rules #438
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
tony
force-pushed
the
ruff-rules
branch
2 times, most recently
from
August 11, 2023 23:19
0e64bb6
to
b66da15
Compare
tony
force-pushed
the
ruff-rules
branch
9 times, most recently
from
August 20, 2023 15:36
8c6bfb8
to
b0dfa5b
Compare
src/libvcs/pytest_plugin.py:176:19: TRY002 Create your own exception src/libvcs/pytest_plugin.py:176:19: TRY003 Avoid specifying long messages outside the exception class
src/libvcs/pytest_plugin.py:210:34: B006 [*] Do not use mutable data structures for argument defaults src/libvcs/pytest_plugin.py:234:38: B006 [*] Do not use mutable data structures for argument defaults
src/libvcs/_internal/query_list.py:87:9: TRY300 Consider moving this statement to an `else` block src/libvcs/_internal/query_list.py:119:9: SIM102 Use a single `if` statement instead of nested `if` statements src/libvcs/_internal/query_list.py:451:19: TRY002 Create your own exception src/libvcs/_internal/query_list.py:451:19: TRY003 Avoid specifying long messages outside the exception class src/libvcs/_internal/query_list.py:489:25: TRY301 Abstract `raise` to an inner function src/libvcs/_internal/query_list.py:489:31: TRY003 Avoid specifying long messages outside the exception class
Fixed 105 errors: - conftest.py: 1 × UP006 (non-pep585-annotation) - docs/conf.py: 1 × RUF100 (unused-noqa) 1 × SIM108 (if-else-block-instead-of-if-exp) 1 × I001 (unsorted-imports) - src/libvcs/_internal/query_list.py: 6 × ERA001 (commented-out-code) 1 × SIM118 (in-dict-keys) - src/libvcs/_internal/run.py: 3 × ERA001 (commented-out-code) - src/libvcs/_internal/types.py: 1 × RUF100 (unused-noqa) - src/libvcs/cmd/git.py: 8 × RUF005 (collection-literal-concatenation) 1 × SIM108 (if-else-block-instead-of-if-exp) 1 × SIM102 (collapsible-if) - src/libvcs/cmd/hg.py: 1 × SIM108 (if-else-block-instead-of-if-exp) - src/libvcs/cmd/svn.py: 2 × UP006 (non-pep585-annotation) 1 × SIM108 (if-else-block-instead-of-if-exp) 1 × F401 (unused-import) - src/libvcs/sync/base.py: 1 × UP031 (printf-string-formatting) 1 × UP032 (f-string) - src/libvcs/sync/git.py: 1 × UP031 (printf-string-formatting) 1 × SIM102 (collapsible-if) 1 × ERA001 (commented-out-code) 1 × SIM108 (if-else-block-instead-of-if-exp) - src/libvcs/sync/hg.py: 1 × RUF100 (unused-noqa) - src/libvcs/sync/svn.py: 1 × RUF100 (unused-noqa) 1 × ERA001 (commented-out-code) 1 × SIM108 (if-else-block-instead-of-if-exp) 1 × B007 (unused-loop-control-variable) - src/libvcs/url/git.py: 1 × RUF100 (unused-noqa) 1 × C416 (unnecessary-comprehension) 1 × B010 (set-attr-with-constant) - src/libvcs/url/hg.py: 1 × RUF100 (unused-noqa) 1 × B010 (set-attr-with-constant) - src/libvcs/url/registry.py: 6 × UP006 (non-pep585-annotation) - src/libvcs/url/svn.py: 2 × RUF100 (unused-noqa) 1 × ERA001 (commented-out-code) 1 × B010 (set-attr-with-constant) - tests/_internal/test_query_list.py: 28 × C408 (unnecessary-collection-call) 2 × SIM300 (yoda-conditions) - tests/sync/test_base.py: 2 × SIM300 (yoda-conditions) 1 × RUF010 (explicit-f-string-type-conversion) - tests/sync/test_git.py: 3 × SIM300 (yoda-conditions) 1 × C416 (unnecessary-comprehension) 1 × I001 (unsorted-imports) - tests/test_pytest_plugin.py: 1 × ERA001 (commented-out-code) 1 × RUF015 (unnecessary-iterable-allocation-for-first-element) - tests/url/test_git.py: 1 × ERA001 (commented-out-code) - tests/url/test_hg.py: 1 × ERA001 (commented-out-code) - tests/url/test_registry.py: 3 × UP006 (non-pep585-annotation) 1 × B007 (unused-loop-control-variable) - tests/url/test_svn.py: 1 × ERA001 (commented-out-code)
Codecov Report
@@ Coverage Diff @@
## master #438 +/- ##
==========================================
+ Coverage 62.18% 62.52% +0.34%
==========================================
Files 39 39
Lines 3403 3437 +34
Branches 936 928 -8
==========================================
+ Hits 2116 2149 +33
- Misses 765 771 +6
+ Partials 522 517 -5
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
docs/conf.py:208:9: PERF203 `try`-`except` within a loop incurs performance overhead src/libvcs/_internal/shortcuts.py:108:19: TRY003 Avoid specifying long messages outside the exception class src/libvcs/_internal/shortcuts.py:108:19: F821 Undefined name `LibVCSException` src/libvcs/_internal/shortcuts.py:110:19: TRY003 Avoid specifying long messages outside the exception class src/libvcs/_internal/shortcuts.py:110:19: F821 Undefined name `LibVCSException` src/libvcs/_internal/shortcuts.py:120:19: TRY003 Avoid specifying long messages outside the exception class src/libvcs/_internal/subprocess.py:437:15: TRY002 Create your own exception src/libvcs/_internal/subprocess.py:437:15: TRY003 Avoid specifying long messages outside the exception class src/libvcs/cmd/svn.py:822:19: TRY003 Avoid specifying long messages outside the exception class src/libvcs/sync/git.py:143:19: TRY002 Create your own exception src/libvcs/sync/git.py:143:19: TRY003 Avoid specifying long messages outside the exception class src/libvcs/sync/git.py:275:19: TRY002 Create your own exception src/libvcs/sync/git.py:275:19: TRY003 Avoid specifying long messages outside the exception class src/libvcs/sync/git.py:385:13: TRY400 Use `logging.exception` instead of `logging.error` src/libvcs/sync/git.py:410:23: TRY003 Avoid specifying long messages outside the exception class src/libvcs/sync/git.py:439:13: TRY400 Use `logging.exception` instead of `logging.error` src/libvcs/sync/git.py:447:17: TRY400 Use `logging.exception` instead of `logging.error` src/libvcs/sync/git.py:459:21: TRY400 Use `logging.exception` instead of `logging.error` src/libvcs/sync/git.py:465:17: TRY400 Use `logging.exception` instead of `logging.error` src/libvcs/sync/git.py:473:21: TRY400 Use `logging.exception` instead of `logging.error` src/libvcs/sync/git.py:480:21: TRY400 Use `logging.exception` instead of `logging.error` src/libvcs/sync/git.py:498:25: TRY400 Use `logging.exception` instead of `logging.error` src/libvcs/sync/git.py:498:25: TRY400 Use `logging.exception` instead of `logging.error` src/libvcs/sync/git.py:509:17: TRY400 Use `logging.exception` instead of `logging.error` src/libvcs/sync/git.py:589:19: TRY002 Create your own exception src/libvcs/sync/git.py:589:19: TRY003 Avoid specifying long messages outside the exception class src/libvcs/sync/git.py:676:23: TRY002 Create your own exception src/libvcs/sync/git.py:676:23: TRY003 Avoid specifying long messages outside the exception class src/libvcs/sync/svn.py:107:12: PTH110 `os.path.exists()` should be replaced by `Path.exists()` src/libvcs/sync/svn.py:107:45: PTH112 `os.path.isdir()` should be replaced by `Path.is_dir()` src/libvcs/sync/svn.py:118:26: PTH118 `os.path.join()` should be replaced by `Path` with `/` operator src/libvcs/sync/svn.py:119:20: PTH110 `os.path.exists()` should be replaced by `Path.exists()` src/libvcs/sync/svn.py:159:24: PTH118 `os.path.join()` should be replaced by `Path` with `/` operator src/libvcs/sync/svn.py:160:12: PTH110 `os.path.exists()` should be replaced by `Path.exists()` src/libvcs/sync/svn.py:161:18: PTH123 `open()` should be replaced by `Path.open()` src/libvcs/sync/svn.py:175:23: TRY003 Avoid specifying long messages outside the exception class src/libvcs/url/git.py:291:20: B007 Loop control variable `v` not used within loop body src/libvcs/url/hg.py:220:20: B007 Loop control variable `v` not used within loop body src/libvcs/url/svn.py:204:20: B007 Loop control variable `v` not used within loop body tests/sync/test_git.py:110:12: PTH110 `os.path.exists()` should be replaced by `Path.exists()` tests/sync/test_hg.py:55:10: B017 `pytest.raises(Exception)` should be considered evil tests/sync/test_svn.py:29:12: PTH110 `os.path.exists()` should be replaced by `Path.exists()` tests/test_exc.py:12:15: TRY003 Avoid specifying long messages outside the exception class tests/test_exc.py:38:15: TRY003 Avoid specifying long messages outside the exception class
tony
added a commit
that referenced
this pull request
Aug 20, 2023
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.
Docs:
Adds:
See also: vcs-python/vcspull#417