Skip to content

STYLE: Additional flake8 checks #22122

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

Closed
6 tasks done
mroeschke opened this issue Jul 30, 2018 · 5 comments
Closed
6 tasks done

STYLE: Additional flake8 checks #22122

mroeschke opened this issue Jul 30, 2018 · 5 comments
Labels
Code Style Code style, linting, code_checks Master Tracker High level tracker for similar issues

Comments

@mroeschke
Copy link
Member

mroeschke commented Jul 30, 2018

Currently we ignore some flake8 checks:

Checks that (currently) we're okay with skipping

  • E402, # module level import not at top of file
  • E731, # do not assign a lambda expression, use a def
  • W503 # line break before binary operator

Checks that should be run

  • E741, # do not use variables named 'l', 'O', or 'I' Enforce flake8 E741 #22795 (CLN: Flake8 E741 #23131)
  • C405, # Unnecessary (list/tuple) literal - rewrite as a set literal.
  • C406 # Unnecessary (list/tuple) literal - rewrite as a dict literal.
  • C408, # Unnecessary (dict/list/tuple) call - rewrite as a literal.
  • C409, # Unnecessary (list/tuple) passed to tuple() - (remove the outer call to tuple()/rewrite as a tuple literal).
  • C410 # Unnecessary (list/tuple) passed to list() - (remove the outer call to list()/rewrite as a list literal).

Ideally, we should continue to lint our codebase with reasonable flake8 checks.

@mroeschke mroeschke added the Code Style Code style, linting, code_checks label Jul 30, 2018
@jbrockmendel
Copy link
Member

I’d be +1 on adding E741

@mroeschke mroeschke added the Master Tracker High level tracker for similar issues label Sep 20, 2018
@jbrockmendel
Copy link
Member

I'm noticing in test_offsets assert not MonthEnd() in _daterange_cache which I would expect flake8 to complain should be assert MonthEnd() not in _daterange_cache. Any idea why this isn't being chcked?

@jbrockmendel
Copy link
Member

Recently saw flake8-eradicate, which looks for commented-out code. It seems to produce a lot of false-positives, so we probably wouldn't want it in the CI, just a one-time run to do a dedicated remove-it-all sweep.

@jbrockmendel
Copy link
Member

Not sure if this is specifically flake8, but it'd be nice to use a linter to prevent creep in the dependency structure. Specifically, once a file has zero-runtime-imports, we could have a check to keep it that way.

@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Dec 11, 2019
@mroeschke
Copy link
Member Author

Looks like our code checks are linting all the flake8 codes mentioned above. Going to close this issue out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks Master Tracker High level tracker for similar issues
Projects
None yet
Development

No branches or pull requests

3 participants