github dosisod/refurb v1.4.0
Version 1.4.0

latest releases: v2.0.0, v1.28.0, v1.27.0...
23 months ago

This version includes a bunch of bug fixes, some new flags, and a new check!

(Small) Breaking Change

Previously, the command line arguments overrode any and all settings in the config file, which probably isn't what most users would expect. Now, the command line arguments will merge with the existing config file settings (if there are any), with the command line arguments taking precedence.

The --config-file flag

This flag can be used to specify where the config file should be pulled from. The file can be named anything, but it must be in TOML format, and the settings must still be in the [tool.refurb] section. See #62 for more info.

The --disable flag

To complement the --enable flag (added in #41), the --disable flag has been added. This should give users more control over how checks are loaded. See the README for more info.

The "set discard" check

When removing keys from a set(), you don't need to check if it exists before removing it:

nums = set((1, 2, 3))

if 1 in nums:
    nums.remove(1)

Refurb will suggests you do this instead:

nums = set((1, 2, 3))

nums.discard(1)

What's Changed

  • Fix operator precedence not being upheld by @dosisod in #54
  • Fix bugs in the "with suppress" check by @dosisod in #55
  • Use mypy compatible method for conditional import by @michaeloliverx in #39
  • Partially fix variable type related issues by @dosisod in #58
  • Add more developer documentation by @dosisod in #61
  • Add --config-file flag by @dosisod in #62
  • Make command line arguments merge with config file instead of overriding it by @dosisod in #63
  • Fix "use func name" check allowing non-positional arguments by @dosisod in #65
  • Fix CI workflow running twice when pushing PR by @dosisod in #66
  • Add bug report issue template by @dosisod in #67
  • Show error message when error code doesn't have a docstring by @dosisod in #68
  • Improve refurb gen functionality: by @dosisod in #69
  • Improve "no len compare" check by @dosisod in #71
  • Add ability to disable checks by @dosisod in #73
  • Test generated visitor methods by @jdevera in #60
  • Add "set discard" check by @dosisod in #74

New Contributors

Full Changelog: v1.3.0...v1.4.0

Don't miss a new refurb release

NewReleases is sending notifications on new releases.