github dosisod/refurb v1.16.0
Version 1.16.0

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

This version adds a few new checks (and fixes a few bugs).

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

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-single-item-in check (FURB171)

Don't use in to check against a single value, use == instead:

Bad:

if name in ("bob",):
    pass

Good:

if name == "bob":
    pass

What's Changed

Full Changelog: v1.15.0...v1.16.0

Don't miss a new refurb release

NewReleases is sending notifications on new releases.