Stricter linting rules - #417
Merged
Merged
Conversation
ruff --show-fixes --fix .
Fixed 73 errors:
- conftest.py:
1 × UP006 (non-pep585-annotation)
- docs/conf.py:
1 × I001 (unsorted-imports)
1 × SIM108 (if-else-block-instead-of-if-exp)
1 × RUF100 (unused-noqa)
- scripts/generate_gitlab.py:
1 × I001 (unsorted-imports)
1 × SIM300 (yoda-conditions)
1 × UP031 (printf-string-formatting)
1 × UP032 (f-string)
1 × UP024 (os-error-alias)
- src/vcspull/__init__.py:
1 × RUF100 (unused-noqa)
- src/vcspull/_internal/config_reader.py:
5 × UP006 (non-pep585-annotation)
- src/vcspull/cli/__init__.py:
3 × UP006 (non-pep585-annotation)
- src/vcspull/cli/sync.py:
1 × UP006 (non-pep585-annotation)
- src/vcspull/config.py:
5 × UP006 (non-pep585-annotation)
5 × B006 (mutable-argument-default)
4 × RUF013 (implicit-optional)
1 × I001 (unsorted-imports)
1 × UP018 (native-literals)
- src/vcspull/log.py:
1 × SIM210 (if-expr-with-true-false)
- src/vcspull/types.py:
1 × I001 (unsorted-imports)
1 × UP006 (non-pep585-annotation)
- src/vcspull/util.py:
1 × UP006 (non-pep585-annotation)
- src/vcspull/validator.py:
1 × UP006 (non-pep585-annotation)
1 × PERF102 (incorrect-dict-iterator)
1 × SIM102 (collapsible-if)
1 × B007 (unused-loop-control-variable)
- tests/__init__.py:
1 × RUF100 (unused-noqa)
- tests/helpers.py:
2 × UP006 (non-pep585-annotation)
1 × C408 (unnecessary-collection-call)
- tests/test_cli.py:
3 × SIM105 (suppressible-exception)
2 × I001 (unsorted-imports)
1 × UP006 (non-pep585-annotation)
- tests/test_config.py:
6 × UP006 (non-pep585-annotation)
- tests/test_config_file.py:
2 × B007 (unused-loop-control-variable)
1 × SIM117 (multiple-with-statements)
- tests/test_repo.py:
2 × SIM300 (yoda-conditions)
1 × I001 (unsorted-imports)
1 × PERF102 (incorrect-dict-iterator)
1 × B007 (unused-loop-control-variable)
- tests/test_sync.py:
2 × SIM118 (in-dict-keys)
2 × PERF102 (incorrect-dict-iterator)
1 × I001 (unsorted-imports)
1 × UP006 (non-pep585-annotation)
tony
force-pushed
the
ruff-rules
branch
3 times, most recently
from
September 2, 2023 11:01
c1c1184 to
9654088
Compare
docs/conf.py:204:9: PERF203 `try`-`except` within a loop incurs performance overhead
tony
force-pushed
the
ruff-rules
branch
2 times, most recently
from
September 2, 2023 11:10
4d5c14e to
0b47239
Compare
Codecov Report
@@ Coverage Diff @@
## master #417 +/- ##
==========================================
+ Coverage 83.55% 84.69% +1.13%
==========================================
Files 16 16
Lines 912 921 +9
Branches 168 176 +8
==========================================
+ Hits 762 780 +18
+ Misses 100 90 -10
- Partials 50 51 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
scripts/generate_gitlab.py:45:8: PTH113 `os.path.isfile()` should be replaced by `Path.is_file()` scripts/generate_gitlab.py:60:19: SIM115 Use context handler for opening files scripts/generate_gitlab.py:60:19: PTH123 `open()` should be replaced by `Path.open()` scripts/generate_gitlab.py:75:15: PTH109 `os.getcwd()` should be replaced by `Path.cwd()` scripts/generate_gitlab.py:93:15: TRY002 Create your own exception scripts/generate_gitlab.py:93:15: TRY003 Avoid specifying long messages outside the exception class src/vcspull/_internal/config_reader.py:105:19: SIM115 Use context handler for opening files src/vcspull/_internal/config_reader.py:105:19: PTH123 `open()` should be replaced by `Path.open()` src/vcspull/cli/sync.py:95:9: PERF203 `try`-`except` within a loop incurs performance overhead src/vcspull/cli/sync.py:107:21: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling src/vcspull/cli/sync.py:107:21: TRY200 Use `raise from` to specify exception cause src/vcspull/cli/sync.py:147:19: TRY002 Create your own exception src/vcspull/cli/sync.py:147:19: TRY003 Avoid specifying long messages outside the exception class src/vcspull/config.py:31:45: B008 Do not perform function call `pathlib.Path.cwd` in argument defaults src/vcspull/config.py:47:25: PTH111 `os.path.expanduser()` should be replaced by `Path.expanduser()` src/vcspull/config.py:55:50: B008 Do not perform function call `pathlib.Path.cwd` in argument defaults src/vcspull/config.py:145:32: PTH111 `os.path.expanduser()` should be replaced by `Path.expanduser()` src/vcspull/config.py:147:32: PTH111 `os.path.expanduser()` should be replaced by `Path.expanduser()` src/vcspull/config.py:214:29: PTH111 `os.path.expanduser()` should be replaced by `Path.expanduser()` src/vcspull/config.py:230:52: B008 Do not perform function call `pathlib.Path.cwd` in argument defaults src/vcspull/config.py:336:13: PERF401 Use a list comprehension to create a transformed list src/vcspull/util.py:12:21: PTH111 `os.path.expanduser()` should be replaced by `Path.expanduser()` src/vcspull/util.py:34:22: PTH118 `os.path.join()` should be replaced by `Path` with `/` operator src/vcspull/util.py:41:16: PTH111 `os.path.expanduser()` should be replaced by `Path.expanduser()` src/vcspull/util.py:42:12: PTH112 `os.path.isdir()` should be replaced by `Path.is_dir()` tests/test_config_file.py:96:13: PERF401 Use a list comprehension to create a transformed list tests/test_config_file.py:393:10: B017 `pytest.raises(Exception)` should be considered evil Found 27 errors.
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
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:
See also: vcs-python/libvcs#438