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.6.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...)
- dangerous default value
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.6.1.tar.gz
(8.0 kB
view details)
Built Distribution
File details
Details for the file cython_lint-0.6.1.tar.gz
.
File metadata
- Download URL: cython_lint-0.6.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb474f5195b904838daa2e7718d1cc6fd2bb231bda467b40c6a744e0a87221c7 |
|
MD5 | 73e9d695f0ef7569dee144cd25823a8a |
|
BLAKE2b-256 | d2eebbe1df7418ad46601a791a143a50cfb556cb0054a2f768787d02e4d2db78 |
Provenance
File details
Details for the file cython_lint-0.6.1-py2.py3-none-any.whl
.
File metadata
- Download URL: cython_lint-0.6.1-py2.py3-none-any.whl
- Upload date:
- Size: 8.3 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 | 0c84208611789b87ea87686b311487b240562db172a736c3de1772d601c323d4 |
|
MD5 | c7ee2590a0f22c16446e22c6e4a08bd0 |
|
BLAKE2b-256 | ee750c81b2b906f65eb4c322e5c1dd0a30749c68204abab83d336a1c36babd42 |