EPITA C Coding Style Checker - validates C code against EPITA coding standards
Project description
EPITA C Coding Style Checker
A fast C code linter that validates against EPITA coding style rules. Uses tree-sitter for robust parsing.
Installation
pipx install epita-coding-style
Or with pip:
pip install epita-coding-style
Usage
epita-coding-style <path> [options]
# Examples
epita-coding-style . # Check current directory
epita-coding-style src/ # Check a directory recursively
epita-coding-style main.c utils.h # Check specific files
# Options
epita-coding-style src/ --max-lines 30 # Max 30 lines per function
epita-coding-style src/ --max-args 5 # Max 5 args per function
epita-coding-style src/ --no-color # Disable colored output
epita-coding-style src/ -q # Quiet mode (summary only)
Rules Checked
| Rule | Description |
|---|---|
fun.length |
Max 40 lines per function body |
fun.arg.count |
Max 4 arguments per function |
fun.proto.void |
Empty params should use void |
export.fun |
Max 10 exported functions per file |
export.other |
Max 1 exported global variable |
braces |
Allman brace style (braces on own line) |
decl.single |
One declaration per line |
decl.vla |
No variable-length arrays |
file.trailing |
No trailing whitespace |
file.dos |
No CRLF line endings |
file.terminate |
File must end with newline |
file.spurious |
No blank lines at start/end |
lines.empty |
No consecutive empty lines |
cpp.guard |
Header files need include guards |
cpp.mark |
Preprocessor # on first column |
cpp.if |
#endif needs comment |
cpp.digraphs |
No digraphs/trigraphs |
stat.asm |
No asm declarations |
ctrl.empty |
Empty loops should use continue |
Example Output
src/parser.c
42: [MAJOR] fun.arg.count: 'parse_node' has 5 args (max 4)
156: [MAJOR] fun.length: Function has 45 lines (max 40)
src/utils.c
12: [MINOR] file.trailing: Trailing whitespace
Files: 2 Major: 2 Minor: 1
Development
# Clone and setup
git clone https://github.com/KazeTachinuu/coding-style
cd coding-style
uv sync --dev
# Run tests
uv run pytest
# Build
python -m build
License
MIT
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
epita_coding_style-2.0.1.tar.gz
(12.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file epita_coding_style-2.0.1.tar.gz.
File metadata
- Download URL: epita_coding_style-2.0.1.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91013b045fb048d938ed49c7961f436c28e152d82573914d51b7229d6ff7a472
|
|
| MD5 |
0472a5780fc130f1ce2271f429b0f68e
|
|
| BLAKE2b-256 |
4168a43896f22e5bae47b43fbd26c09647f5664abe581d6b2ba5ce91de9bac82
|
File details
Details for the file epita_coding_style-2.0.1-py3-none-any.whl.
File metadata
- Download URL: epita_coding_style-2.0.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee603e2b8e18f174591acfd87b8d48d162046ed350f4d46caa479a47f989ec70
|
|
| MD5 |
e05637185bc950c5ed32e03d2ff4c838
|
|
| BLAKE2b-256 |
f7c871d69ac4a79ea05c9d59a159520ab7514e3114bab363cad4ddea00961e1d
|