github dosisod/refurb v1.15.0
Version 1.15.0

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

This version adds 3 new checks!

Add use-long-regex-flag check (FURB167)

Regex operations can be changed using flags such as re.I, which will make the regex case-insensitive. These single-character flag names can be harder to read/remember, and should be replaced with the longer aliases so that they are more descriptive.

Bad:

if re.match("^hello", "hello world", re.I):
    pass

Good:

if re.match("^hello", "hello world", re.IGNORECASE):
    pass

Add no-isinstance-type-none (FURB168)

Checking if an object is None using isinstance() is un-pythonic: use an is comparison instead.

Bad:

x = 123

if isinstance(x, type(None)):
    pass

Good:

x = 123

if x is None:
    pass

Add no-is-type-none check (FURB169)

Don't use type(None) to check if the type of an object is None, use an is comparison instead.

Bad:

x = 123

if type(x) is type(None):
    pass

Good:

x = 123

if x is None:
    pass

What's Changed

Full Changelog: v1.14.0...v1.15.0

Don't miss a new refurb release

NewReleases is sending notifications on new releases.