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

Ruff fails on the issue introduced during fix #5150

Closed
Cjkjvfnby opened this issue Jun 16, 2023 · 1 comment
Closed

Ruff fails on the issue introduced during fix #5150

Cjkjvfnby opened this issue Jun 16, 2023 · 1 comment
Labels
fixes Related to suggested fixes for violations

Comments

@Cjkjvfnby
Copy link
Contributor

Applying FLY002 to the code creates a code that does not pass E501 Line too long

This check is mentioned in the #2102

Code sample:

expected = "\n".join(
    [
        "=== long text ======================================================================",
        "=== long text ======================================================================",
    ],
)
ruff scratch.py
scratch.py:1:12: FLY002 [*] Consider `"=== long text ======================================================================\n=== long text ======================================================================"` instead of string join    
Found 1 errors.
[*] 1 potentially fixable with the --fix option.
ruff scratch.py --fix
scratch.py:1:99: E501 Line too long (183 > 98 characters)
Found 1 errors (1 fixed, 0 remaining).
@MichaReiser
Copy link
Member

I think in this case it's best to use a noqa comment. We used to consider the line length for some rules but this can lead to undesired false-negatives because it's far from a good metric for complexity.

Another alternative here, but it requires human intervention, is to use a multiline string instead.

@MichaReiser MichaReiser closed this as not planned Won't fix, can't repro, duplicate, stale Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants