Module implementing a checker for naming conventions.
None |
NamingStyleChecker | Class implementing a checker for naming conventions. |
None |
Class implementing a checker for naming conventions.
Category |
Codes |
None |
NamingStyleChecker | Constructor |
__checkClassName | Private class to check the given node for class name conventions (N801, N818). |
__checkFunctionArgumentNames | Private class to check the argument names of functions (N803, N804, N805, N806). |
__checkFunctionName | Private class to check the given node for function name conventions (N802, N809). |
__checkImportAs | Private method to check that imports don't change the naming convention (N811, N812, N813, N814, N815). |
__checkModule | Private method to check module naming conventions (N807, N808). |
__checkNameToBeAvoided | Private class to check the given node for a name to be avoided (N831). |
__checkVariableNames | Private method to check variable names in function, class and global scope (N821, N822, N823). |
__classVariableCheck | Private method to determine the error code for a variable in class scope. |
__extractNames | Private method to extract the names from the target node. |
__findGlobalDefs | Private method amend a node with global definitions information. |
__findVariableNameErrors | Private method to check, if there is a variable name error. |
__functionVariableCheck | Private method to determine the error code for a variable in class scope. |
__getArgNames | Private method to get the argument names of a function node. |
__getClassdef | Private method to extract the class definition. |
__globalVariableCheck | Private method to determine the error code for a variable in global scope. |
__isMixedCase | Private method to check, if the given name is mixed case. |
__isNameToBeAvoided | Private method to check, if the given name should be avoided. |
__isNamedTupel | Private method to check, if a node is a named tuple. |
__superClassNames | Private method to extract the names of all super classes. |
__tagClassFunctions | Private method to tag functions if they are methods, class methods or static methods. |
__visitNode | Private method to inspect the given AST node. |
__visitTree | Private method to scan the given AST tree. |
addErrorFromNode | Public method to build the error information. |
run | Public method to execute the relevant checks. |
None |
Constructor
Private class to check the given node for class name conventions (N801, N818).
Almost without exception, class names use the CapWords convention. Classes for internal use have a leading underscore in addition.
Private class to check the argument names of functions (N803, N804, N805, N806).
The argument names of a function should be lowercase, with words separated by underscores. A class method should have 'cls' as the first argument. A method should have 'self' as the first argument.
Private class to check the given node for function name conventions (N802, N809).
Function names should be lowercase, with words separated by underscores as necessary to improve readability. Functions not being methods '__' in front and back are not allowed. Mixed case is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility.
Private method to check that imports don't change the naming convention (N811, N812, N813, N814, N815).
Private method to check module naming conventions (N807, N808).
Module and package names should be lowercase.
Private class to check the given node for a name to be avoided (N831).
Private method to check variable names in function, class and global scope (N821, N822, N823).
Local variables in functions should be lowercase.
Private method to determine the error code for a variable in class scope.
Private method to extract the names from the target node.
Private method amend a node with global definitions information.
Private method to check, if there is a variable name error.
Private method to determine the error code for a variable in class scope.
Private method to get the argument names of a function node.
Private method to extract the class definition.
Private method to determine the error code for a variable in global scope.
Private method to check, if the given name is mixed case.
Private method to check, if the given name should be avoided.
Private method to check, if a node is a named tuple.
Private method to extract the names of all super classes.
Private method to tag functions if they are methods, class methods or static methods.
Private method to inspect the given AST node.
Private method to scan the given AST tree.
Public method to build the error information.
Public method to execute the relevant checks.