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

Add flake8-bugbear as plugin to pre-commit #6809

Merged
merged 9 commits into from
Aug 9, 2022

Conversation

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2022

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

       15 files  +       3         15 suites  +3   6h 34m 25s ⏱️ + 2h 1m 0s
  2 992 tests +       2    2 903 ✔️ +     13       88 💤  -   12  1 +1 
22 189 runs  +4 207  21 139 ✔️ +4 076  1 049 💤 +130  1 +1 

For more details on these failures, see this check.

Results for commit 9104b35. ± Comparison against base commit 602148f.

♻️ This comment has been updated with latest results.

@hendrikmakait
Copy link
Member Author

Should we also include B904?

B904: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling. See the exception chaining tutorial for details.

@fjetter
Copy link
Member

fjetter commented Aug 8, 2022

Should we also include B904?

My suggestion would be to enable whatever works right now, disable/ignore everything else, get the PR merged asap to avoid regressions. We can enable/disable more error codes in a follow up

@hendrikmakait hendrikmakait marked this pull request as ready for review August 8, 2022 14:31
Copy link
Member Author

@hendrikmakait hendrikmakait left a comment

Choose a reason for hiding this comment

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

Restructured some code that triggered

B023: Functions defined inside a loop must not use variables redefined in the loop, because late-binding closures are a classic gotcha.

@@ -3896,10 +3896,10 @@ def test_threaded_get_within_distributed(c):

for get in [dask.local.get_sync, dask.multiprocessing.get, dask.threaded.get]:

def f():
def f(get):
Copy link
Member Author

Choose a reason for hiding this comment

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

B023

distributed/tests/test_client.py Outdated Show resolved Hide resolved
@@ -1542,7 +1542,7 @@ async def close( # type: ignore
if executor is utils._offload_executor:
continue # Never shutdown the offload executor

def _close(wait):
def _close(executor, wait):
Copy link
Member Author

Choose a reason for hiding this comment

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

B023

@@ -4017,8 +4017,8 @@ async def test_serialize_future(s, a, b):
result = await future

for ci in (c1, c2):
for ctxman in ci.as_current, lambda: temp_default_client(ci):
with ctxman():
for ctxman in lambda ci: ci.as_current(), lambda ci: temp_default_client(ci):
Copy link
Member Author

Choose a reason for hiding this comment

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

B023

additional_dependencies:
# NOTE: autoupdate does not pick up flake8-bugbear since it is a transitive
# dependency. Make sure to update flake8-bugbear manually on a regular basis.
- flake8-bugbear==22.7.1
Copy link
Member Author

Choose a reason for hiding this comment

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

Pinned with added comments because autoupdate doesn't help us here.

@hendrikmakait
Copy link
Member Author

CI flake: #6860

@fjetter fjetter merged commit 2e928ec into dask:main Aug 9, 2022
gjoseph92 pushed a commit to gjoseph92/distributed that referenced this pull request Oct 31, 2022
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.

Add flake8-bugbear as additional flake8 plugin
2 participants