Welcome to itzma-lint’s documentation!¶
Description¶
⭑・゚゚・*:༅。.。༅:*゚:*:✼✿ ITZMA Lint (It's my lint!) ✿✼:*゚:༅。.。༅:*・゚゚・⭑
"Your Lint, Your Rules"
Overview
Do you love using a linter but want even more personalized rules? Building off a traditional lint, ITZMA offers additional features such as:
Enforcing all functions that change the state of the programs to begin with verbs
Enforcing all functions that return values to be nouns
Enforcing array names to be plural nouns
… and more!
Of course, ITZMA also contains traditional features, such as:
Enforcing all booleans to begin with pre-allowed verbs
Enforcing consistent case types
… and more!
ITZMA is a linter that lets you decide how your code will look and helps you enforce those rules!
Installation and Usage
I’m excited to share Itzma with everyone! To use Itzma locally, please install the following dependencies:
flake8
ast
inflection
nltk
Use the following command to install the dependencies:
pip install <library name>
To use Itzma to check your Python file, simply run the following in your terminal in the appropriate directory:
flake8 <filename>
A message will be printed for each Itzma check that was not passed! For more information about Itzma checks and error messages, check out checks.py.
“I’m a llama, not an ITZMA (lint)!”
Documentation¶
- class checks.LocalImportsNotAllowed¶
- classmethod check_import_inside_function(node: FunctionDef, errors: list[helpers.Flake8ASTErrorInfo]) None ¶
Check if there’s an import inside a function
- Parameters:
node – ast.FunctionDef
errors – a list of errors found
- class checks.UnconventionalFunctionNamesNotAllowed¶
- classmethod check_first_word_in_function_name_is_verb(node: FunctionDef, errors: list[helpers.Flake8ASTErrorInfo]) None ¶
Check if the first word in the function name is a verb
- Parameters:
node – ast.FunctionDef
errors – a list of errors found
- classmethod check_function_name_camel_case(node: FunctionDef, errors: list[helpers.Flake8ASTErrorInfo]) None ¶
Check if a function name is a de-capitalized camel case
- Parameters:
node – ast.FunctionDef
errors – a list of errors found
- classmethod check_function_name_snake_case(node: FunctionDef, errors: list[helpers.Flake8ASTErrorInfo]) None ¶
Check if a function name is a snake case
- Parameters:
node – ast.FunctionDef
errors – a list of errors found
- class checks.UnconventionalClassNamesNotAllowed¶
- classmethod check_class_name_camel_case(node: ClassDef, errors: list[helpers.Flake8ASTErrorInfo]) None ¶
Check if a class name is a capitalized camel case
- Parameters:
node – ast.ClassDef
errors – a list of errors found
- class checks.UnconventionalVariableNamesNotAllowed¶
- classmethod check_last_word_in_variable_name_is_noun(node: Assign, errors: list[helpers.Flake8ASTErrorInfo]) None ¶
Check if the last word in the variable name is a noun
- Parameters:
node – ast.FunctionDef
errors – a list of errors found
- classmethod check_variable_name_camel_case(node: Assign, errors: list[helpers.Flake8ASTErrorInfo]) None ¶
Check if a function name is a de-capitalized camel case
- Parameters:
node – ast.FunctionDef
errors – a list of errors found
- classmethod check_variable_name_plurality(node: Assign, errors: list[helpers.Flake8ASTErrorInfo]) None ¶
Check if a variable name assigned to a list is plural
- Parameters:
node – ast.FunctionDef
errors – a list of errors found
- classmethod check_variable_name_snake_case(node: Assign, errors: list[helpers.Flake8ASTErrorInfo]) None ¶
Check if a function name is a snake case
- Parameters:
node – ast.FunctionDef
errors – a list of errors found
Examples¶
To check the formatting of file_sample.py, run the following command:
- code:
flake8 file_sample.py
To focus on CamelCase(IMC) or snake_case(IMS) add tag –select
- code:
flake8 file_sample.py —select=IMC
or
- code:
flake8 file_sample.py —select=IMS