llvm / llvm/circt

Proposal: Add a pre-commit hook configuration

Open
#9,103 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

Hi everyone,

I’ve noticed that some of the .td (TableGen) files in the repository contain trailing whitespace and minor formatting inconsistencies. To help avoid these and others in the future, and to make contributor workflows a bit smoother, I’d like to propose adding a [pre-commit](https://pre-commit.com/) configuration to the repo.

A pre-commit setup would:
* Automatically strip trailing whitespace and fix end-of-file newlines
* Enforce consistent formatting by using the same fixed clang-format version used in CI
* Make it easier for contributors to catch common issues locally before committing

This would not affect build behavior and can be gradually adopted.
If people are open to the idea, I can open a PR with a minimal `.pre-commit-config.yaml` and documentation on how to enable it.

WDYT?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the repository's existing CI clang-format version and the formatting issues in the .td (TableGen) files. Define a minimal .pre-commit-config.yaml that uses that fixed version, strips trailing whitespace, and enforces end-of-file newlines; document how contributors enable it. Done means the hooks reproduce the relevant CI formatting checks without changing build behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.