Enforce ASCII
A Python package to find files containing non-ASCII encoded characters. If you find any bugs, issues or anything, please use the issue tracker on GitHub - issues and PRs are welcome ❤️
Install
It's on [PyPi] as ski-lint, you can install it with pip, pipx, etc.
pip install ski-lint
Usage
$ ski-lint --help
usage: ski-lint [-h] [--version] [--check] [-w CONTEXT_WIDTH] [-c CONFIG_FILE] FILENAME [FILENAME ...]
A pre-commit hook, that rejects files containing non-ASCII characters.
positional arguments:
FILENAME path to the files to check
options:
-h, --help show this help message and exit
--version show program's version number and exit
--check return code is `1`, when non-ASCII files are found
-w, --context-width CONTEXT_WIDTH
width of the context of the non-ASCII line
-c, --config-file CONFIG_FILE
path to config file
Configuration
CONFIG_FILE
You can use an optional yaml file (default .ski-lint.yml) in which you can override any CLI argument
or add additional configuration:
accepted_values:
- U+E4
- U+2026
context_width: 50
Hint: you may use the following resource to get required unicode symbol.
Environment variables
SKI_LINT_LOG_LEVEL(INFO, DEBUG, WARNING, ...): sets the corresponding log level, default is INFO.
Example
$ ski-lint tests/files/*/*.txt
2024-10-03 16:24:50,339 - ERROR - tests/files/bad/special.txt (Windows-1252), line 1, pos 9, char U+2026 '…', context: 'Hi there…'
2024-10-03 16:24:50,339 - ERROR - tests/files/bad/umlaut.txt (utf-8), line 1, pos 349, char U+E4 'ä', context: 'y next level pitchfork käle chips leggings gastrop'
2024-10-03 16:24:50,339 - ERROR - tests/files/bad/umlaut.txt (utf-8), line 1, pos 547, char U+F6 'ö', context: 'gs. Waistcoat jianbing föur dollar toast jean shor'
2024-10-03 16:24:50,339 - ERROR - tests/files/bad/umlaut.txt (utf-8), line 3, pos 190, char U+C5 'Å', context: 'eitan viral photo booth Åir plant cliche neutra la'
2024-10-03 16:24:50,339 - ERROR - tests/files/bad/zero-width-space.txt (Windows-1252), line 1, pos 62, non-printable char U+200B, context: 'ace (U+200B) at the end!U+200B'
You can also pass glob patterns directly to ski-lint. Quote patterns containing * so the tool
expands them itself; recursive patterns such as **/* are supported. Directory arguments are
scanned recursively:
ski-lint --check '**/*'
Pre-Commit
This can be used as a pre-commit hook:
- repo: https://github.com/svdimchenko/ski-lint
rev: v0.3.3
hooks:
- id: ski-lint
Metadata
Release files for ski-lint 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ski_lint-0.3.3.tar.gz | 6.3 kB | Without provenance | Details for ski_lint-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ski_lint-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for ski_lint-0.3.3-py3-none-any.whl |
Total release size: 13.5 kB
Release files / ski_lint-0.3.3.tar.gz
| Download URL | ski_lint-0.3.3.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac6c0fc823891ae6bbebb9b410373aaaeb0218d246704dc767c03e9342d25de6
|
|
BLAKE2b-256 checksum How to use checksums |
985f9083af20c180cca4acf2fe667ce6e50f65cc93c53d6f8630663550948488
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.1 Linux/7.0.0-1017-azure
|
Release files / ski_lint-0.3.3-py3-none-any.whl
| Download URL | ski_lint-0.3.3-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
490ee51624d75059a13a00c2562a1f3bbd61b2d47e90fba4ab1efd2c1fb3d57d
|
|
BLAKE2b-256 checksum How to use checksums |
b688f7d36a5f38c03e577875a8d8feaa675d4e8c669157bbc68249430e21a699
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.1 Linux/7.0.0-1017-azure
|
Security for ski-lint 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.