BACK TO LIST

Python rules

The Codiga Static Analysis engine is powered by the best open-source tools to check your Python code. Make sure your code does not have any security issues and follow design and other best practices. Automate your code reviews today and merge with confidence with Codiga.

C0123

Best practice
Warning

Using type() instead of isinstance() for a typecheck.

Learn more

C0200

Best practice
Warning

Consider using enumerate instead of iterating with range and len

C0201

Best practice
Warning

Consider iterating the dictionary directly instead of calling .keys()

C0410

Best practice
Warning

Multiple imports on one line

C0411

Best practice
Warning

Wrong import order

C0415

Best practice
Warning

Import not put at the top level of the file

W0401

Best practice
Warning

Use of wildcard imports

W0404

Best practice
Warning

Module imported twice

W0603

Best practice
Warning

Using the global statement

W0612

Best practice
Warning

Unused variable

W1201

Best practice
Warning

Do not use lazy formatting

W1202

Best practice
Warning

Do not use format() in logging function

W1306

Best practice
Warning

Missing format attribute

W1308

Best practice
Warning

Duplicate string formatting argument

W1401

Best practice
Warning

Anomalous backslash in string

W1503

Best practice
Warning

Redundant use of unit test assert

W1505

Best practice
Warning

Use of deprecated method

W1506

Best practice
Warning

Thread needs the target function

C0206

Best practice
Warning

Consider iterating with .items()

C0207

Best practice
Warning

Accessing only the first or last element of str.split() and should be done more efficiently.

C1802

Best practice
Warning

Use implicit boolean with len()

C0208

Best practice
Warning

Use a sequence type when iterating over values When iterating over values, sequence types (e.g., lists, tuples, ranges) are more efficient than sets.

R0203

Best practice
Warning

Consider using a decorator instead of calling staticmethod

R1725

Best practice
Warning

Consider using Python 3 style super() without arguments

R1732

Best practice
Warning

Consider using 'with' for resource-allocating operations

W0177

Best practice
Warning

An expression is compared to NaNvalues like numpy.NaN and float('nan')

W1406

Best practice
Warning

Used when we detect a string with a u prefix. These prefixes were necessary in Python 2 to indicate a string was Unicode, but since Python 3.0 strings are Unicode by default.

W1512

Best practice
Warning

Using deprecated module

W1513

Best practice
Warning

Use deprecated decorator

C2801

Best practice
Warning

Unnecessarily calls dunder method %s. %s.

W1515

Best practice
Warning

Leaving functions creating breakpoints in production code is not recommended.

R1736

Best practice
Warning

Unnecessary list index lookup, use '%s' instead.

W1518

Best practice
Warning

cache will keep all method args alive indefinitely, including 'self'

W0130

Best practice
Warning

Duplicate value in set

We use cookies to improve your site experience, including analytics cookies to understand how you use our product and design better experiences. Please read our Cookie Policy.