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.3
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.3.tar.gz
(8.1 kB
view details)
Built Distribution
File details
Details for the file cython_lint-0.6.3.tar.gz
.
File metadata
- Download URL: cython_lint-0.6.3.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c8208818ec6f247a5810d025e6f768b5f9cced2c8706b79fab22444fbe22aa7 |
|
MD5 | a6e96f047bfd5bdf189bd0d6240a46ff |
|
BLAKE2b-256 | 353a3e6691dd2b0eb0d4ecb15830f449e62ecad85c1fd6917fab4464e7f67262 |
Provenance
File details
Details for the file cython_lint-0.6.3-py2.py3-none-any.whl
.
File metadata
- Download URL: cython_lint-0.6.3-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.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e4aa3cb5a69b8551d1f6cc0735614737e756841b751ca8868182c2f06e55591 |
|
MD5 | 0129f3ab5d367c0bb8aecc2cfbbd4070 |
|
BLAKE2b-256 | 5c78ad8c096cb701737abea3cf969680a76894bed91a34752336711131b19547 |