Welcome to itzma-lint’s documentation!

Description

⭑・゚゚・*:༅。.。༅:*゚:*:✼✿   ITZMA Lint (It's my lint!)   ✿✼:*゚:༅。.。༅:*・゚゚・⭑

"Your Lint, Your Rules"

GitHub GitHub issues Itzma workflow codecov PyPI Docs

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.Flake8ASTErrorInfo(line_number, offset, msg, cls)

Create new instance of Flake8ASTErrorInfo(line_number, offset, msg, cls)

cls: type

Alias for field number 3

line_number: int

Alias for field number 0

msg: str

Alias for field number 2

offset: int

Alias for field number 1

class checks.LocalImportsNotAllowed
classmethod check(node: FunctionDef, errors: list[checks.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(node: FunctionDef, errors: list[checks.Flake8ASTErrorInfo]) None

Check if a function name is a de-capitalized camel case

Parameters:
  • node – ast.FunctionDef

  • errors – a list of errors found

classmethod checkFirstWordIsVerb(node: FunctionDef, errors: list[checks.Flake8ASTErrorInfo]) None

Check if the first word in the function name is a verb

Parameters:
  • node – ast.FunctionDef

  • errors – a list of errors found

class checks.UnconventionalClassNamesNotAllowed
classmethod check(node: ClassDef, errors: list[checks.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(node: FunctionDef, errors: list[checks.Flake8ASTErrorInfo]) None

Check if a variable name assigned to a list is plural

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

Indices and tables