facebook pixelPython Static Analysis Rules
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
      Medium

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

      Learn more

      C0200

      Best practice
      Medium

      Consider using enumerate instead of iterating with range and len

      C0201

      Best practice
      Medium

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

      C0410

      Best practice
      Medium

      Multiple imports on one line

      C0411

      Best practice
      Medium

      Wrong import order

      C0415

      Best practice
      Medium

      Import not put at the top level of the file

      W0401

      Best practice
      Medium

      Use of wildcard imports

      W0404

      Best practice
      Medium

      Module imported twice

      W0603

      Best practice
      Medium

      Using the global statement

      W1201

      Best practice
      Medium

      Do not use lazy formatting

      W1202

      Best practice
      Medium

      Do not use format() in logging function

      W1306

      Best practice
      Medium

      Missing format attribute

      W1308

      Best practice
      Medium

      Duplicate string formatting argument

      W1401

      Best practice
      Medium

      Anomalous backslash in string

      W1503

      Best practice
      Medium

      Redundant use of unit test assert

      W1505

      Best practice
      Medium

      Use of deprecated method

      W1506

      Best practice
      Medium

      Thread needs the target function

      C0206

      Best practice
      Medium

      Consider iterating with .items()

      C0207

      Best practice
      Medium

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

      C1802

      Best practice
      Medium

      Use implicit boolean with len()

      C0208

      Best practice
      Medium

      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
      Medium

      Consider using a decorator instead of calling staticmethod

      R1725

      Best practice
      Medium

      Consider using Python 3 style super() without arguments

      R1732

      Best practice
      Medium

      Consider using 'with' for resource-allocating operations

      W0177

      Best practice
      Medium

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

      W1406

      Best practice
      Medium

      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
      Medium

      Using deprecated module

      W1513

      Best practice
      Medium

      Use deprecated decorator

      C2801

      Best practice
      Medium

      Unnecessarily calls dunder method %s. %s.

      W1515

      Best practice
      Medium

      Leaving functions creating breakpoints in production code is not recommended.

      R1736

      Best practice
      Medium

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

      W1518

      Best practice
      Medium

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