Variables, Classes and functions should not be undefined, otherwise the code will fail with a NameError.

Noncompliant Code Example

my_var # Noncompliant (variable is never defined)

def noncompliant():
    foo()  # Noncompliant
    MyClass()  # Noncompliant

Compliant Solution

from mod import my_var

my_var

def compliant():
    foo = sum
    foo()

    class MyClass:
        pass
    MyClass()