epita-coding-style
Linter for the EPITA C and C++ coding style: tree-sitter checks plus clang-format.
Install
pipx install epita-coding-style
Requires Python >= 3.10. The format check needs clang-format on PATH;
without it the check is skipped with a warning.
Usage
epita-coding-style src/ # check a directory recursively
epita-coding-style main.c list.h # check specific files
epita-coding-style --preset 42sh src/ # use a preset
git ls-files '*.c' | epita-coding-style - # read paths from stdin
epita-coding-style --list-rules # list every rule
$ epita-coding-style src/
src/list.c:5:1: error: 'list_sum' has 5 args (max 4) [epita-fun.arg.count]
int list_sum(int *values, int len, int start, int step, int max)
src/list.c:7:5: error: One declaration per line [epita-decl.single]
int sum = 0, i;
^
src/list.c:8:1: error: 1 line needs formatting [epita-format]
Files: 1 Major: 3 Minor: 0
Fix formatting:
clang-format --style=file:.../epita_coding_style/.clang-format-c -i src/list.c
What gets scanned
| Language | Extensions |
|---|---|
| C | .c, .h |
| C++ | .cc, .hh, .hxx (.cpp/.hpp are checked but flagged by file.ext) |
Directories are scanned recursively. Hidden files and directories are skipped,
and inside a git repo so is everything git ignores (.gitignore,
.git/info/exclude, global excludes). Files named explicitly are always checked.
Configuration
The first config found in the current directory or any parent is used:
.epita-style, .epita-style.toml, epita-style.toml, or the
[tool.epita-coding-style] table of pyproject.toml. --config FILE picks one explicitly.
preset = "42sh"
max_lines = 40
[rules]
"keyword.goto" = false
"cast" = false
Priority: CLI flags > config file > preset > defaults.
| Preset | Effect |
|---|---|
ppex1 |
max_casts = 5 |
42sh |
max_lines = 40, disables keyword.goto, cast |
noformat |
same as 42sh, also disables format |
| Limit | C | C++ | Flag |
|---|---|---|---|
max_lines |
30 | 50 | --max-lines |
max_args |
4 | 4 | --max-args |
max_funcs |
10 | - | --max-funcs |
max_globals |
1 | - | --max-globals |
max_casts |
0 | - | --max-casts |
max_casts is a budget shared by all C files checked in one run, so run it on
the whole project (epita-coding-style .). Over budget, every cast is reported.
"cast" = false allows any number of casts.
--show-config prints the effective configuration as loadable TOML: settings
you changed are live lines, everything else is a commented-out default.
epita-coding-style --show-config --no-color > .epita-style.toml
clang-format
For each file, the nearest config from the file's directory up to the root is
used: .clang-format-c (C) or .clang-format-cxx (C++), then .clang-format.
If none is found, the bundled EPITA config for that language is used.
Disable with "format" = false or --preset noformat.
Pre-commit
repos:
- repo: https://github.com/KazeTachinuu/epita-coding-style
rev: v3.5.0
hooks:
- id: epita-coding-style
args: [--preset, 42sh] # optional
A commit only checks the staged files, so max_casts counts the casts in those
files alone. To enforce the budget on the whole project, check it all:
- id: epita-coding-style
args: [--preset, ppex1, .]
pass_filenames: false
Editor integration
Neovim: epita-nvim-lint.
Diagnostics are GCC-style (file:line:col: error: ...), so any editor that
parses them works, e.g. Vim with makeprg=epita-coding-style\ %.
Checked one file at a time, max_casts only counts that file's casts.
Exit codes
| Code | Meaning |
|---|---|
| 0 | no major violations |
| 1 | major violations found |
| 2 | usage, config or file error |
Environment
| Variable | Effect |
|---|---|
NO_COLOR |
disable colors |
FORCE_COLOR |
force colors when not a terminal |
EPITA_STYLE_NO_UPDATE_CHECK |
disable the daily PyPI version check (only runs in a terminal, never in CI) |
Metadata
Release files for epita-coding-style 3.5.0
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 |
|---|---|---|---|---|
| epita_coding_style-3.5.0.tar.gz | 52.2 kB | Without provenance | Details for epita_coding_style-3.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| epita_coding_style-3.5.0-py3-none-any.whl | Python 3 | none | any | Details for epita_coding_style-3.5.0-py3-none-any.whl |
Total release size: 85.3 kB
Release files / epita_coding_style-3.5.0.tar.gz
| Download URL | epita_coding_style-3.5.0.tar.gz |
|---|---|
| Size | 52.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9deb5119e3c499b383298ac7c218c11bb03fcce99fff87b9123a2f89ff631bcb
|
|
BLAKE2b-256 checksum How to use checksums |
1c34beab72ecfba0e5be750453c4787c6ba9ab5b7e059eeef16d3bb0b275e216
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / epita_coding_style-3.5.0-py3-none-any.whl
| Download URL | epita_coding_style-3.5.0-py3-none-any.whl |
|---|---|
| Size | 33.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a06d5fed68e2313aab2249d9c0239f57e4f3b4f02c5f9e965fc265e6175a384
|
|
BLAKE2b-256 checksum How to use checksums |
501561d6181889e998ba7409b60930f28b0cb398180f2c46a4be15af47f55d3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for epita-coding-style 3.5.0
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.