A linter for Cython files
Project description
cython-lint
A tool and pre-commit hook to lint Cython files.
Installation
$ pip install cython-lint
Usage as a pre-commit hook
See pre-commit for instructions
Sample .pre-commit-config.yaml
:
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.5.1
hooks:
- id: cython-lint
Command-line example
$ cython-lint my_file_1.pyx my_file_2.pyx
my_file_1.pyx:54:5: 'get_conversion_factor' imported but unused
my_file_2.pyx:1112:38: 'mod' defined but unused
Configuration
The following configuration options are available:
- exclude lines by including a
# no-cython-lint
comment (analogous to# noqa
inflake8
); - use the command-line argument
--max-line-length
to control the maximum line length used by pycodestyle; - use the command-line argument
--no-pycodestyle
if you don't want the pycodestyle checks.
Which checks are implemented?
- variable defined but unused
- variable imported but unused
- comma after base type definition (e.g.
cdef ndarray, arr
) - f-string without placeholders
- dict key repeated
- dict key variable repeated
- if-statement with tuple condition (always true...)
- assert statement with tuple condition (always true...)
pycodestyle
nitpicks, which you can turn off with--no-pycodestyle
More to come! Requests welcome!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cython_lint-0.5.1.tar.gz
(7.9 kB
view details)
Built Distribution
File details
Details for the file cython_lint-0.5.1.tar.gz
.
File metadata
- Download URL: cython_lint-0.5.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62eb060b6502915e4161b93c15dea276a3334aafd39efe03cbea50d68d85784e |
|
MD5 | 89c0ca4612ff53b13345a4c682d46146 |
|
BLAKE2b-256 | 4bbb6f312798ee0da46789c00b37e1e49c6603332892d1428e48504c68bf1577 |
Provenance
File details
Details for the file cython_lint-0.5.1-py2.py3-none-any.whl
.
File metadata
- Download URL: cython_lint-0.5.1-py2.py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 812afae7671e34c0918648394a694073a26382358584e462bc7bd1a9ea759be5 |
|
MD5 | 07f4a5f84758c921d218bdea29013774 |
|
BLAKE2b-256 | 85e5c503abf6e47ef44509416ba3852e6d6d7ab06b91932e95b3d243b4654f44 |