Skip to content

Stricter linting rules - #417

Merged
tony merged 8 commits into
masterfrom
ruff-rules
Sep 2, 2023
Merged

Stricter linting rules#417
tony merged 8 commits into
masterfrom
ruff-rules

Conversation

@tony

@tony tony commented Jul 4, 2023

Copy link
Copy Markdown
Member

tony added 3 commits September 1, 2023 17:51
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
tony force-pushed the ruff-rules branch 3 times, most recently from c1c1184 to 9654088 Compare September 2, 2023 11:01
docs/conf.py:204:9: PERF203 `try`-`except` within a loop incurs performance overhead
@tony
tony force-pushed the ruff-rules branch 2 times, most recently from 4d5c14e to 0b47239 Compare September 2, 2023 11:10
@codecov

codecov Bot commented Sep 2, 2023

Copy link
Copy Markdown

Codecov Report

Merging #417 (d9e3659) into master (583b207) will increase coverage by 1.13%.
The diff coverage is 84.05%.

@@            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     
Files Changed Coverage Δ
conftest.py 78.04% <ø> (ø)
tests/test_config.py 96.87% <ø> (ø)
tests/test_repo.py 55.73% <0.00%> (ø)
src/vcspull/validator.py 33.33% <50.00%> (-3.51%) ⬇️
src/vcspull/cli/sync.py 73.33% <75.00%> (+1.24%) ⬆️
src/vcspull/config.py 83.89% <82.60%> (-0.67%) ⬇️
src/vcspull/_internal/config_reader.py 94.44% <100.00%> (ø)
src/vcspull/log.py 82.45% <100.00%> (+14.03%) ⬆️
src/vcspull/util.py 100.00% <100.00%> (ø)
tests/helpers.py 76.66% <100.00%> (ø)
... and 3 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

tony added 3 commits September 2, 2023 06:26
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.
@tony
tony merged commit 32359ad into master Sep 2, 2023
@tony
tony deleted the ruff-rules branch September 2, 2023 11:33
tony added a commit that referenced this pull request Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant