Skip to content

Some additional Ruff rules to consider / Code quality improvements #741

@Casper-Guo

Description

@Casper-Guo
  • Bugbear (B): better exception handling workflow and other gotchas
  • Builtins (A): In our case, mostly using round as a variable name
  • Trailing commas (COM): Lists shouldn't use trailing commas
  • Comprehensions (C4): Mostly matter of preference but does warn about some unnecessary casting of generators
  • Implicit string concat (ISC): This one can be especially helpful given that we use implicit string concatenation quite a bit to get around the line width limit, and they are quite mistake-prone
  • Quotes (Q): We use a mix of single and double quotes. Having more consistency would be nice.
  • Return (RET): Mostly matter of preference but occasionally save a lot of debugging headaches when one unintentionally returns None at the end of functions. If we use this we will ignore a big subset of the rules
  • Unused arguments (ARG)
  • pandas-vet (PD): Helps catching some methods no longer recommended by Pandas and/or subjected to future deprecation

Thoughts on these?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions