Skip to content

fixing e501 for tests/commands#2688

Open
JohananOppongAmoateng wants to merge 7 commits intobeeware:mainfrom
JohananOppongAmoateng:e501-tests
Open

fixing e501 for tests/commands#2688
JohananOppongAmoateng wants to merge 7 commits intobeeware:mainfrom
JohananOppongAmoateng:e501-tests

Conversation

@JohananOppongAmoateng
Copy link
Contributor

@JohananOppongAmoateng JohananOppongAmoateng commented Feb 16, 2026

This pr is a continuation of fixes for the e501 issues in #2383

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@JohananOppongAmoateng JohananOppongAmoateng marked this pull request as ready for review February 16, 2026 13:34
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for those updates - looks like more good progress towards clean Ruff output.

I've flagged a few places where the formatting is valid, but needs an update to be consistent with our internal style. I've also flagged a couple of places where the style choices are a bit odd. If those places are the result of automated update from Ruff, then we'll live with the output of that tool - but if they're manually applied choices, in most cases, the older syntax is preferred.

Comment on lines 135 to 136
"\n stderr: '\nfatal: could not clone repository"
" 'https://example.com' \n'",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in the past PR - when we've got a string as one argument of many, it's preferable to use bracket notation to highlight that this is one string argument, not two:

Suggested change
"\n stderr: '\nfatal: could not clone repository"
" 'https://example.com' \n'",
(
"\n stderr: '\nfatal: could not clone repository"
" 'https://example.com' \n'"
),

Comment on lines 141 to 145
"\n stderr: '\nfatal: Could not read from remote repository.\n\nPlease"
" make sure you have the correct access rights\nand the repository"
" exists. \n'",
"Could not read from remote repository.\n\nPlease make sure "
"you have the correct access rights\nand the repository exists.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above - these two should be bracket-wrapped

Comment on lines 149 to 152
"\n stderr: '\nfatal: unable to access 'https://example.com/': "
"OpenSSL/3.2.2: error:0A000438:SSL routines::tlsv1 alert internal error'",
"Unable to access 'https://example.com/': OpenSSL/3.2.2: "
"error:0A000438:SSL routines::tlsv1 alert internal error.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above - these two should be bracket-wrapped

Comment on lines 52 to 53
f"The directory {bundle_path.relative_to(base_path)} already exists; overwrite"
" [y/N]? "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples like this one are a bit of a judgement call as to whether extra parentheses are needed, as it's a list with one item; I'd be inclined to they should, to reinforce that it's a single prompt in a list.

(Similarly for the 2 other equivalent changes in this file)

Comment on lines 267 to 268
filename=tmp_path
/ "data/stub/986428ef9d5a1852fc15d4367f19aa328ad530686056e9d83cdde03407c0bceb/My-Stub.zip",
/ "data/stub/986428ef9d5a1852fc15d4367f19aa328ad530686056e9d83cdde03407c0bceb/My-Stub.zip", # noqa: E501
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preference here would be (a) to use brackets to clarify the scope of the filename argument, and (b) to break the string in more places to avoid the need for the noqa. Github won't let me code suggest here, but something like:

        filename=(
            tmp_path
            / "data/stub"
            / "986428ef9d5a1852fc15d4367f19aa328ad530686056e9d83cdde03407c0bceb"
            / "My-Stub.zip"
        ),

assert capsys.readouterr().out == (
"\n"
assert (
capsys.readouterr().out == "\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an odd change - the brackets are the exact opposite of what I would have expected. The reasoning is the same as for other bracket usage - it's not intuitive to tell which statements are the start of a string, and which the start of a new argument. The previous formatting made this clear - copses.readouterr().out = (...some multiline string...); the new formatting is ambiguous.


def test_test_dependencies_without_requires():
"If the global config doesn't specify test requirements, test dependencies are used as is"
"""If the global config doesn't specify test requirements, test " "dependencies are
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A stray pair of quotes, probably from a line break that existed at one point:

Suggested change
"""If the global config doesn't specify test requirements, test " "dependencies are
"""If the global config doesn't specify test requirements, test dependencies are

(
"There is nothing wrong with your television set.\n"
"Do not attempt to adjust the picture."
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to this change - this is the preferred format for multi-line strings.

"Wait message... started\nWait message... finished\n"
assert (
capsys.readouterr().out == "Wait message... started\nWait message... finished\n"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a value judgement - if an automated tool is doing this, then fine; but otherwise the older format would be preferred.

"... still waiting\n... still waiting\n... still waiting\n"
assert (
capsys.readouterr().out
== "... still waiting\n... still waiting\n... still waiting\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again - the older format would be preferred unless this is a tool automated change.

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.

2 participants

Comments