Skip to content

Bump Ruff to v0.15.18 and address new lint violations#826

Open
julianz- wants to merge 3 commits into
cherrypy:mainfrom
julianz-:bump-ruff-v0.15.18
Open

Bump Ruff to v0.15.18 and address new lint violations#826
julianz- wants to merge 3 commits into
cherrypy:mainfrom
julianz-:bump-ruff-v0.15.18

Conversation

@julianz-

Copy link
Copy Markdown
Member

Updates Ruff from v0.13.3 to v0.15.18
This requires the following changes:

  • Fix D421: reword property docstrings to noun phrases
  • Fix ISC004: parenthesize implicit string concatenation in collections; use single strings with # noqa: LN001 where readability is better
  • Drop now-redundant # noqa: D401 comments on property definitions
  • Suppress PLW0717, RUF067, S607 pending future fixes

What kind of change does this PR introduce?

  • 🐞 bug fix
  • 🐣 feature
  • 📋 docs update
  • 📋 tests/coverage improvement
  • 📋 refactoring
  • 💥 other

📋 What is the related issue number (starting with #)

Resolves #

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

📋 Other information:

📋 Contribution checklist:

(If you're a first-timer, check out
[this guide on making great pull requests][making a lovely PR])

  • I wrote descriptive pull request text above
  • I think the code is well written
  • I wrote [good commit messages]
  • I have [squashed related commits together][related squash] after
    the changes have been approved
  • Unit tests for the changes exist
  • Integration tests for the changes exist (if applicable)
  • I used the same coding conventions as the rest of the project
  • The new code doesn't generate linter offenses
  • Documentation reflects the changes
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided A mark meaning that a new change log entry is present within the patch. label Jun 20, 2026
@read-the-docs-community

read-the-docs-community Bot commented Jun 20, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cheroot | 🛠️ Build #33315303 | 📁 Comparing 027fabb against latest (18f4ba8)

  🔍 Preview build  

5 files changed · ± 5 modified

± Modified

@julianz- julianz- force-pushed the bump-ruff-v0.15.18 branch from 794639b to 2bfeca8 Compare June 20, 2026 21:26
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.85%. Comparing base (18f4ba8) to head (027fabb).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #826      +/-   ##
==========================================
- Coverage   78.19%   75.85%   -2.34%     
==========================================
  Files          41       41              
  Lines        4788     4788              
  Branches      547      482      -65     
==========================================
- Hits         3744     3632     -112     
- Misses        905     1012     +107     
- Partials      139      144       +5     

@julianz- julianz- requested a review from webknjaz June 21, 2026 18:17

@webknjaz webknjaz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you feel strongly about those noqas?

Comment thread .ruff.toml Outdated
"PLR6301", # no-self-use # FIXME / noqa

"PLW0717", # too-many-statements-in-try-clause # FIXME

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change

Comment thread .ruff.toml Outdated
"PLR6104", # non-augmented-assignment # FIXME
"PLR6301", # no-self-use # FIXME / noqa

"PLW0717", # too-many-statements-in-try-clause # FIXME

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are there many of these? I mostly prefer narrowly scoped ignores when adding new rules.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There are 8 violations across 6 files. I've moved PLW0717 to per-file ignores (production files + test files) rather than keeping it in the global suppress list — that way the rule stays active everywhere else. Happy to switch to individual # noqa: PLW0717 lines on each violation if you prefer?

Comment thread cheroot/test/_pytest_plugin.py Outdated
'<socket.socket fd=-1, family=AF_INET6, '
'type=SocketKind.SOCK_STREAM, proto=.:'
'pytest.PytestUnraisableExceptionWarning:_pytest.unraisableexception',
'ignore:Exception in thread CP Server Thread-:pytest.PytestUnhandledThreadExceptionWarning:_pytest.threadexception', # noqa: LN001

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd like to keep these multi-line instead of having ignores. Let's go for nested parentheses instead.

Three further new rules are suppressed pending fixes: too many statements
in a try clause (PLW0717), non-empty ``__init__`` modules (RUF067), and
starting a process with a partial executable path (S607)
-- by :user:`julianz-`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You probably want this

Suggested change
-- by :user:`julianz-`.
-- by :user:`julianz-`

Comment thread docs/changelog-fragments.d/826.contrib.rst

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Think fixed now hopefully.

- Fix D421: reword property docstrings to noun phrases
- Fix ISC004: parenthesize implicit string concatenation in collections;
  use single strings with # noqa: LN001 where readability is better
- Drop now-redundant # noqa: D401 comments on property definitions
- Suppress PLW0717, RUF067, S607 pending future fixes
@julianz- julianz- force-pushed the bump-ruff-v0.15.18 branch from 2bfeca8 to 323f3b9 Compare June 23, 2026 19:14

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@julianz- for the future, once you refactor socket handling + TLS, we may be able to drop these warning suppressions, hopefully. Actually, we should try doing so in the respective PRs if they are in place already.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I removed the socket exception suppressions from #779.

Comment thread cheroot/test/test_conn.py Outdated
'Found error in the error log: '
f"message = '{c_msg}', level = '{c_level}'\n"
f'{c_traceback}',
f"Found error in the error log: message = '{c_msg}', level = '{c_level}'\n{c_traceback}" # noqa: LN001

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps, this will do?

Suggested change
f"Found error in the error log: message = '{c_msg}', level = '{c_level}'\n{c_traceback}" # noqa: LN001
f"Found error in the error log: message = '{c_msg}', "
f"level = '{c_level}'\n{c_traceback}"

Comment thread cheroot/test/test_conn.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's address the violations instead of suppressing them.

Three further new rules are suppressed pending fixes: too many statements
in a try clause (PLW0717), non-empty ``__init__`` modules (RUF067), and
starting a process with a partial executable path (S607)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Either make the byline a part of the sentence (no need for moving it into a separate paragraph w/ a trailing period), or add a trailing period to the previous paragraph and drop it from the byline.

Suggested change

Comment thread docs/conf.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Address these instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not sure what you mean here?

@webknjaz

Copy link
Copy Markdown
Member

Another note: I'm not sure how I feel about marking agents commit authors. I'd rather have a plain text mention or an assisted-by trailer. It's probably good to port the ai policy from pip-tools into this project.

Suppresses too-many-statements-in-try-clause only in the files that
actually trigger it, rather than globally. Test files are also covered.
Global suppression masked the rule entirely; per-file ignores leave it
active elsewhere and make the FIXMEs more targeted.
@julianz- julianz- force-pushed the bump-ruff-v0.15.18 branch from a9282c0 to 50e147f Compare June 25, 2026 22:07
… from test files

Replace # noqa: LN001 suppressions with properly split strings wrapped
in parentheses to satisfy ISC004. Remove PLW0717 from the test file
ignore list — test files have no violations so the suppression was
unnecessary.
@julianz- julianz- force-pushed the bump-ruff-v0.15.18 branch from 50e147f to 027fabb Compare June 25, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided A mark meaning that a new change log entry is present within the patch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants