Skip to content
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

Apply ruff/flake8-implicit-str-concat rule ISC001 #615

Closed
wants to merge 4 commits into from

Conversation

DimitriPapadopoulos
Copy link
Contributor

Copy link

codecov bot commented May 6, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 71.09%. Comparing base (bd8ab85) to head (c8cac99).

Files Patch % Lines
src/wheel/cli/convert.py 0.00% 2 Missing ⚠️
src/wheel/bdist_wheel.py 0.00% 1 Missing ⚠️
src/wheel/cli/__init__.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #615   +/-   ##
=======================================
  Coverage   71.09%   71.09%           
=======================================
  Files          13       13           
  Lines        1083     1083           
=======================================
  Hits          770      770           
  Misses        313      313           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@agronholm
Copy link
Contributor

I think what would be best is to actually add the relevant ruff rule to pyproject.toml and then let nature take its course.

@DimitriPapadopoulos
Copy link
Contributor Author

It is not compatible with ruff format (yet):
astral-sh/ruff#8272

@agronholm
Copy link
Contributor

In the link issue, this is discussed and, as far as I could understand, ISC001 is not actually incompatible with the formatter.

@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented May 6, 2024

It's still in the conflict list.

@DimitriPapadopoulos
Copy link
Contributor Author

I could change:

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: ruff
args: [--fix, --show-fixes]
- id: ruff-format

into:

- repo: https://github.com/astral-sh/ruff-pre-commit
  rev: v0.4.3
  hooks:
    - id: ruff
      args: [--fix, --show-fixes]
    - id: ruff-format
    - id: ruff
      args: [ --select, ISC001, --fix, --show-fixes ]

Rule ISC001 is currently in the formatter conflict list:
https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules

As a workaround, run the linter specifically for rule ISC001 after the
formatter:
astral-sh/ruff#8272 (comment)

The usual sequence is to run the linter with before the formatter.
@agronholm
Copy link
Contributor

Actually I now have a sweeping change commit locally that would do all this, and more.

https://docs.astral.sh/ruff/rules/printf-string-formatting/

This rule is enfoirced by newer versions of ruff (> 0.3.5).
@agronholm agronholm closed this in 0b7771e May 8, 2024
@agronholm
Copy link
Contributor

These sweeping changes covered all of the changes here, so I'm closing this PR as no longer necessary. Thanks for bringing this up!

@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented May 8, 2024

Now I get this warning whenever I run ruff:

$ ruff format
warning: The following rules may cause conflicts when used with the formatter: `ISC001`. To avoid unexpected behavior, we recommend disabling these rules, either by removing them from the `select` or `extend-select` configuration, or adding them to the `ignore` configuration.
54 files left unchanged
$ 

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.

None yet

2 participants