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

# Check current directory
coding-style-check

# Check specific files or directories
coding-style-check src/
coding-style-check main.c utils.h

# Options
coding-style-check --help
coding-style-check --max-lines 30    # Custom max function lines
coding-style-check --max-args 5      # Custom max function args
coding-style-check --no-color        # Disable colored output
coding-style-check -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.0.tar.gz (12.7 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.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: epita_coding_style-2.0.0.tar.gz
  • Upload date:
  • Size: 12.7 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.0.tar.gz
Algorithm Hash digest
SHA256 b67418bd8a81e75c10e68e5d4b751a47775ff1e3e3dda4c4c730c3b2c5893b1a
MD5 3cfa993d9b176d595727f85f52342c54
BLAKE2b-256 23c4e0d6ecbecf853248cc3af96a7807787916fc6ad833cf196c8860ce13d1c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for epita_coding_style-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61414f1fd6b88bf78bf749fe4fb06cc4d9885f7ac6a532be94c604ef3855ba1a
MD5 c7a07d9013455b2325e176c5c4fd04d3
BLAKE2b-256 67333dc5eb983d7da195be775e3a1670bf4b3f6d17b4f01371cd4fa0efccaaa9

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