Skip to content

Add more ruff rules #4001

@dopplershift

Description

@dopplershift

Add more rules to our ruff config. Current ones I'm seeing:

  • Pathlib PTH
  • Pytest style PT
  • PyLint PL

A brief check shows some things I'd want to look into with the first two. Pylint will need to be more judicious, since a brief look seems to show some things I don't care to fix (overwriting loop variables). That said, I also just saw this while writing:

PLW0177 Comparing against a NaN value; use `math.isnan` instead
    --> src/metpy/io/gempak.py:2599:12
     |
2598 |         station['TIME'] = parsed.date_time.time()
2599 |         if math.nan in [parsed.altimeter, parsed.elevation, parsed.temperature]:
     |            ^^^^^^^^
2600 |             station['PMSL'] = missing
2601 |         else:
     |

which is suspicious but somehow isn't a bug, though should be changed anyways:

import math

a = [1, 1.1, math.nan]

math.nan in a

True

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: InfrastructurePertains to project infrastructure (e.g. CI, linting)Type: EnhancementEnhancement to existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions