Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.
According to PEP8, function names should be lowercase, with words separated by underscores as necessary to improve readability. This convention is
known as "snake_case." For example: calculate_area
, print_hello
, process_data
To fix this, respect the naming convention for the function. The default naming convention is snake case, as recommended by PEP8. Other naming
conventions can be defined through the format
rule parameter.
Code examples
Noncompliant code example
With the default provided regular expression: ^[a-z_][a-z0-9_]*$
def MyFunction(a,b):
...
Compliant solution
def my_function(a,b):
...