Skip to content

Ruff rules: Stricter code quality rules #879

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 45 commits into from
Sep 4, 2023
Merged

Ruff rules: Stricter code quality rules #879

merged 45 commits into from
Sep 4, 2023

Conversation

tony
Copy link
Member

@tony tony commented Jul 8, 2023

@tony tony force-pushed the ruff-rules branch 2 times, most recently from 1d98369 to 8b9f897 Compare August 4, 2023 12:08
@tony tony force-pushed the ruff-rules branch 3 times, most recently from b96922d to a72c4e7 Compare August 26, 2023 11:08
@tony tony force-pushed the ruff-rules branch 3 times, most recently from 9dc3eef to 78afa34 Compare September 1, 2023 22:51
@tony tony force-pushed the ruff-rules branch 17 times, most recently from e9da12b to c4b45f9 Compare September 4, 2023 11:33
@codecov
Copy link

codecov bot commented Sep 4, 2023

Codecov Report

Merging #879 (08a9c03) into master (4140006) will decrease coverage by 0.15%.
The diff coverage is 63.81%.

@@            Coverage Diff             @@
##           master     #879      +/-   ##
==========================================
- Coverage   71.29%   71.15%   -0.15%     
==========================================
  Files          25       25              
  Lines        1850     1893      +43     
  Branches      410      405       -5     
==========================================
+ Hits         1319     1347      +28     
- Misses        411      424      +13     
- Partials      120      122       +2     
Files Changed Coverage Δ
src/tmuxp/types.py 100.00% <ø> (ø)
src/tmuxp/cli/utils.py 54.54% <22.22%> (-1.11%) ⬇️
docs/_ext/aafig.py 21.01% <25.00%> (+1.75%) ⬆️
src/tmuxp/cli/load.py 71.02% <40.00%> (-0.88%) ⬇️
src/tmuxp/shell.py 42.00% <46.66%> (+1.72%) ⬆️
src/tmuxp/util.py 73.86% <57.14%> (-1.14%) ⬇️
src/tmuxp/workspace/finders.py 83.78% <62.50%> (-4.06%) ⬇️
src/tmuxp/workspace/freezer.py 80.43% <62.50%> (-3.66%) ⬇️
docs/conf.py 58.76% <66.66%> (+1.18%) ⬆️
src/tmuxp/exc.py 78.26% <66.66%> (-16.48%) ⬇️
... and 12 more

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

tony added 25 commits September 4, 2023 06:47
src/tmuxp/workspace/builder.py:258:9: B018 Found useless expression. Either assign it to a variable or remove it.
src/tmuxp/workspace/builder.py:456:45: B023 Function definition does not bind loop variable `pane_config`
src/tmuxp/workspace/builder.py:457:32: B023 Function definition does not bind loop variable `pane_config`
src/tmuxp/workspace/builder.py:464:35: B023 Function definition does not bind loop variable `pane_config`
src/tmuxp/workspace/builder.py:465:32: B023 Function definition does not bind loop variable `pane_config`
src/tmuxp/util.py:53:34: PTH100 `os.path.abspath()` should be replaced by `Path.resolve()`
src/tmuxp/util.py:56:9: TRY300 Consider moving this statement to an `else` block
src/tmuxp/util.py:59:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
src/tmuxp/util.py:59:13: TRY200 Use `raise from` to specify exception cause
src/tmuxp/util.py:59:52: PTH100 `os.path.abspath()` should be replaced by `Path.resolve()`
src/tmuxp/util.py:69:5: SIM102 Use a single `if` statement instead of nested `if` statements
src/tmuxp/util.py:70:9: SIM102 Use a single `if` statement instead of nested `if` statements
src/tmuxp/util.py:70:12: PTH110 `os.path.exists()` should be replaced by `Path.exists()`
src/tmuxp/util.py:70:27: PTH111 `os.path.expanduser()` should be replaced by `Path.expanduser()`
src/tmuxp/plugin.py:143:17: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
src/tmuxp/plugin.py:143:17: TRY200 Use `raise from` to specify exception cause
src/tmuxp/config_reader.py:102:19: SIM115 Use context handler for opening files
src/tmuxp/config_reader.py:102:19: PTH123 `open()` should be replaced by `Path.open()`
src/tmuxp/cli/utils.py:218:19: TRY003 Avoid specifying long messages outside the exception class
src/tmuxp/cli/utils.py:224:19: TRY003 Avoid specifying long messages outside the exception class
docs/conf.py:204:9: PERF203 `try`-`except` within a loop incurs performance overhead
conftest.py:72:37: PTH100 `os.path.abspath()` should be replaced by `Path.resolve()`
rc/tmuxp/cli/load.py:122:13: PERF203 `try`-`except` within a loop incurs performance overhead
src/tmuxp/cli/load.py:124:89: E501 Line too long (93 > 88 characters)
src/tmuxp/cli/import_config.py:156:15: SIM115 Use context handler for opening files
src/tmuxp/cli/freeze.py:109:13: TRY301 Abstract `raise` to an inner function
src/tmuxp/cli/freeze.py:109:19: TRY003 Avoid specifying long messages outside the exception class
src/tmuxp/cli/freeze.py:198:15: SIM115 Use context handler for opening files
src/tmuxp/cli/convert.py:64:15: TRY002 Create your own exception
src/tmuxp/cli/convert.py:64:15: TRY003 Avoid specifying long messages outside the exception class
src/tmuxp/cli/convert.py:75:5: SIM102 Use a single `if` statement instead of nested `if` statements
src/tmuxp/cli/convert.py:76:9: SIM102 Use a single `if` statement instead of nested `if` statements
src/tmuxp/cli/convert.py:81:15: SIM115 Use context handler for opening files
docs/_ext/aafig.py:61:23: RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
docs/_ext/aafig.py:147:15: TRY003 Avoid specifying long messages outside the exception class
docs/_ext/aafig.py:176:29: SIM115 Use context handler for opening files
docs/_ext/aafig.py:179:25: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
docs/_ext/aafig.py:179:25: TRY200 Use `raise from` to specify exception cause
docs/_ext/aafig.py:193:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
docs/_ext/aafig.py:193:9: TRY200 Use `raise from` to specify exception cause
docs/_ext/aafig.py:198:13: SIM115 Use context handler for opening files
@tony tony merged commit 075138a into master Sep 4, 2023
@tony tony deleted the ruff-rules branch September 4, 2023 11:56
tony added a commit that referenced this pull request Sep 4, 2023
tony added a commit that referenced this pull request Sep 4, 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