Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@

# make sure build.sh retains Unix line endings, even when checked out on windows.
*.sh text eol=lf

# Git hooks must have Unix line endings to work on all platforms
.githooks/* text eol=lf
17 changes: 17 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
# Pre-commit hook: runs lintrunner on files being committed.
# Skip with: git commit --no-verify

if ! command -v lintrunner >/dev/null 2>&1; then
echo "Warning: lintrunner not found - skipping pre-commit lint."
echo " Install: pip install -r requirements-lintrunner.txt && lintrunner init"
exit 0
fi

lintrunner --paths-cmd='git diff --cached --name-only --diff-filter=ACMR'

if [ $? -ne 0 ]; then
echo ""
echo "Lint failed. Run 'lintrunner -a' to auto-fix, re-stage, and commit again."
exit 1
fi
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ We're always looking for your help to improve the product (bug fixes, new featur
* Make sure your PR adheres to the [PR Guidelines](./docs/PR_Guidelines.md) and [Coding Conventions and Standards](./docs/Coding_Conventions_and_Standards.md) established by the team.
* If you're unsure about any of the above and want to contribute, you're welcome to [start a discussion](https://github.com/microsoft/onnxruntime/discussions) with the team.

## Git hooks (recommended)

Enable the repo's pre-commit hook to run [lintrunner](https://github.com/suo/lintrunner) automatically before each commit:

```sh
git config core.hooksPath .githooks
```

If lint issues are found, the commit is blocked. Run `lintrunner -a` to auto-fix, re-stage, and commit again. Use `git commit --no-verify` to bypass.

> **Note:** `core.hooksPath` replaces Git's default hook directory (`.git/hooks/`). If you have existing custom hooks, you may need to integrate them manually.

## Propose a new public API

ONNX Runtime has a collection of [public APIs](./README.md#api-documentation). Some of these APIs make their way back into the Windows OS. We make compatibility commitments for these APIs and follow a structured process when adding to them. Please use the [Feature Request issue template](https://github.com/microsoft/onnxruntime/issues/new?template=feature_request.md) before starting any PRs that affect any of the public APIs.
Expand Down
Loading