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 simplify #1617

Merged
merged 6 commits into from Dec 21, 2020
Merged

Conversation

dopplershift
Copy link
Member

Description Of Changes

This adds flake8-simplify to our suite of linting plugins. This catches various miscellaneous things, like those I'm fixing here:

  • Use contextlib.suppress to ignore a certain exception
  • Yoda conditions (e.g. if 3 == b:)
  • Using enumerate instead of incrementing a separate counter in a loop
  • Using all/any
  • And many others

@dopplershift dopplershift added Area: Infrastructure Pertains to project infrastructure (e.g. CI, linting) Type: Enhancement Enhancement to existing functionality Type: Maintenance Updates and clean ups (but not wrong) labels Dec 20, 2020
@dopplershift dopplershift added this to the 1.0 milestone Dec 20, 2020
@dopplershift dopplershift force-pushed the flake8-simplify branch 2 times, most recently from 2fe1bea to 9932465 Compare December 20, 2020 22:30
SIM106 is about handling errors early. Right now, it detects a lot of
places where we handle errors as an `else` on a chained if, and I
disagree about other options being more readable.
It's shorter and clearer what's going on. Found by flake8-simplify.
This has a variety of checks suggesting simpler ways to write certain
constructs.
Provoked by flake8-simplify, but also just some general improvements and
consolidation.
@dopplershift dopplershift merged commit 828e1e7 into Unidata:master Dec 21, 2020
@dopplershift dopplershift deleted the flake8-simplify branch December 21, 2020 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Infrastructure Pertains to project infrastructure (e.g. CI, linting) Type: Enhancement Enhancement to existing functionality Type: Maintenance Updates and clean ups (but not wrong)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants