Skip to content

cstlint is a light Python code checker that leverages libcst

Notifications You must be signed in to change notification settings

horacepan/cstlint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSTLint

cstlint is a Python code style checker that leverages libcst. It helps enforce specific style rules in a Python file. It currently checks for the following rules:

  • use of eval/exec/getattr/setattr
  • nested functions
  • lambdas
  • mutable default args
  • assignment to function inputs

Installation

git clone https://github.com/horacepan/cstlint.git
cd cstlint
  1. Setup a virtual environment
python3 -m venv venv
source venv/bin/activate
  1. Install cslint
pip install .

Or install in editable mode if you are doing active development:

pip install -e .

Sample Usage

cstlint {path/to/file}

Additional flags you can set:

  • --verbose: show the violating line
  • --show-source: show the source code before the violations (useful for debugging)
  • --quiet: exit after the first violation

Tests

To run the unit tests:

python -m unittest discover -s tests -v

About

cstlint is a light Python code checker that leverages libcst

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages