Skip to main content

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


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.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epita_coding_style-2.0.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file epita_coding_style-2.0.2.tar.gz.

File metadata

  • Download URL: epita_coding_style-2.0.2.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for epita_coding_style-2.0.2.tar.gz
Algorithm Hash digest
SHA256 937382dd9fc7db82b8aca22120e6b267ced4ea70b0b8b8e33ececc2dd7c62fac
MD5 f3262a8e88c77777385a46d0611608ce
BLAKE2b-256 fa9d6fb1108197e886f2f49af8d8f62cb2c216e8f2ee3f4e66c11954f92828d2

See more details on using hashes here.

File details

Details for the file epita_coding_style-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for epita_coding_style-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 64b2659a67c86ff2690b97954b26225ee59c17d1de0e6682327bd4dc65f891b3
MD5 922b4bdedd2e1bfa8dc91c8c67976c4a
BLAKE2b-256 d8bb96e3c7639770d85f58fce383e18a98be9379870fdf994e4c8373a81b7c9e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page