Version 1.5.0
Since the last release, many flags and checks have been added, and of course, lots of bugs have been fixed as well!
FURB120 is now disabled by default
Due to popular demand, FURB120 has been disabled by default. If you wish to continue using it, you will need to enable it.
The --enable-all
and --disable-all
flags
Two new flags have been added, --enable-all
and --disable-all
. As the names imply, they will enable or disable all checks. The "enable all" option is good for new codebases which want to opt-in to all available checks, whereas "disable all" can be good for existing codebases which need to be incrementally cleaned up.
Read the docs for more info.
The --python-version
flag
This flag can be used to specify what version of Python your codebase is using. This allows for Mypy to better type check your code, and also allows for more useful error messages. When specifying this flag, it must be in the form X.Y
, such as 3.9
or 3.10
.
The "no trailing continue" check
Similar to the "no trailing return" check, this check applies to instances where the continue
keyword is not needed:
for num in range(10):
print(num)
continue
Here, the continue
is not needed, because we are already at the end of the for loop.
The "use @cache decorator" check
Python 3.9 introduced the @cache
decorator, which is a shorthand for @lru_cache(maxsize=None)
. Refurb will now suggest that you change this:
from functools import lru_cache
@lru_cache(maxsize=None)
def f(x: int) -> int:
return x + 1
To this:
from functools import cache
@cache
def f(x: int) -> int:
return x + 1
If you are using Python 3.9+.
What's Changed
- Detect
Path
objects being passed directly toopen()
by @dosisod in #75 - Add
--disable-all
flag by @dosisod in #76 - Fix disabled checks still being loaded by @dosisod in #80
- Bump/cleanup packages by @dosisod in #81
- Fix false positive in FURB125 by @dosisod in #83
- add Python 3.11 to test matrix by @jairhenrique in #84
- Add
--python-version
flag by @dosisod in #85 - Fix
--load
being able to load a single check multiple times by @dosisod in #86 - Allow for dependency injecting settings into checks: by @dosisod in #87
- Add "no trailing continue" check by @dosisod in #88
- Disable FURB120 by default by @dosisod in #89
- Add
--enable-all
flag by @dosisod in #91 - Fix
--enable-all
not enabling checks in all situations by @dosisod in #92 - Add "use @cache decorator" check for Python 3.9 and up by @dosisod in #93
- Add comparison to other tools by @dosisod in #94
New Contributors
- @jairhenrique made their first contribution in #84
Full Changelog: v1.4.0...v1.5.0