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

Enable flake8-bugbear rule #2807

Merged
merged 15 commits into from Oct 23, 2023
Merged

Conversation

CoolCat467
Copy link
Contributor

This PR enables the flake8-bugbear rule and fixes all the existing issues that were raised.

@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Merging #2807 (128ffb0) into master (b161fec) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2807      +/-   ##
==========================================
+ Coverage   99.13%   99.15%   +0.02%     
==========================================
  Files         115      115              
  Lines       17242    17261      +19     
  Branches     3085     3086       +1     
==========================================
+ Hits        17093    17116      +23     
+ Misses        104      101       -3     
+ Partials       45       44       -1     
Files Coverage Δ
trio/_abc.py 100.00% <100.00%> (ø)
trio/_core/_io_windows.py 98.80% <ø> (ø)
trio/_core/_local.py 100.00% <100.00%> (ø)
trio/_core/_run.py 100.00% <100.00%> (ø)
trio/_core/_tests/test_asyncgen.py 99.09% <100.00%> (ø)
trio/_core/_tests/test_guest_mode.py 99.69% <ø> (ø)
trio/_core/_tests/test_instrumentation.py 100.00% <ø> (ø)
trio/_core/_tests/test_multierror.py 100.00% <100.00%> (ø)
trio/_core/_tests/test_parking_lot.py 100.00% <100.00%> (ø)
trio/_core/_tests/test_run.py 100.00% <100.00%> (ø)
... and 26 more

Copy link
Member

@jakkdl jakkdl left a comment

Choose a reason for hiding this comment

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

Big approve on enabling bugbear, bunch of small style comments.

Comment on lines 25 to 31
"RUF", # Ruff-specific rules
"E", # Error
"F", # pyflakes
"E", # Error
"W", # Warning
"I", # isort
"B", # flake8-bugbear
"YTT", # flake8-2020
Copy link
Member

Choose a reason for hiding this comment

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

you moved "E" ... probably want this list sorted?

Copy link
Member

Choose a reason for hiding this comment

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

We should consider running a toml-formatter in pre-commit that does it automatically

pyproject.toml Outdated Show resolved Hide resolved
trio/_core/_io_windows.py Show resolved Hide resolved
trio/_abc.py Show resolved Hide resolved
(
SSL.OP_NO_QUERY_MTU
| SSL.OP_NO_RENEGOTIATION # type: ignore[attr-defined]
)
SSL.OP_NO_QUERY_MTU | SSL.OP_NO_RENEGOTIATION # type: ignore[attr-defined]
Copy link
Member

Choose a reason for hiding this comment

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

is this formatting change due to a version bump?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's changed by black funnily enough, not ruff.
Tested with reverting changes and running pre-commit locally.

Copy link
Member

Choose a reason for hiding this comment

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

Well, it's a good change - but I'm confused why it's in this PR and not in a separate PR that does the actual version bump in the committed config file.

trio/_tests/test_path.py Outdated Show resolved Hide resolved
trio/_tests/test_socket.py Outdated Show resolved Hide resolved
trio/_tests/test_threads.py Outdated Show resolved Hide resolved
trio/_tests/test_tracing.py Outdated Show resolved Hide resolved
trio/socket.py Show resolved Hide resolved
Copy link
Member

@jakkdl jakkdl left a comment

Choose a reason for hiding this comment

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

It feels a bit shitty to put the burden of cleaning up old smelly code in an entirely separate PR that just happens to touch those lines, so feel free to ignore ones you don't want to bother with.

trio/_tests/test_deprecate.py Outdated Show resolved Hide resolved
trio/testing/_fake_net.py Outdated Show resolved Hide resolved
trio/testing/_fake_net.py Outdated Show resolved Hide resolved
trio/testing/_fake_net.py Outdated Show resolved Hide resolved
trio/_dtls.py Outdated Show resolved Hide resolved
trio/_core/_tests/test_multierror.py Outdated Show resolved Hide resolved
trio/_core/_run.py Outdated Show resolved Hide resolved
trio/_core/_tests/test_guest_mode.py Outdated Show resolved Hide resolved
trio/_core/_tests/test_guest_mode.py Outdated Show resolved Hide resolved
trio/_core/_tests/test_instrumentation.py Outdated Show resolved Hide resolved
Copy link
Member

@jakkdl jakkdl left a comment

Choose a reason for hiding this comment

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

Looks great~

@jakkdl jakkdl merged commit 1616c0e into python-trio:master Oct 23, 2023
28 of 30 checks passed
@CoolCat467 CoolCat467 deleted the enable-bugbear branch October 23, 2023 20:45
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

3 participants