Add pre-commit configuration file

Introduce a pre-commit-config.yaml to automate code quality checks and enforce best practices. Includes hooks for file validation, formatting, and commit message standardization, as well as Java-specific quality tools. This ensures consistent coding standards and reduces manual errors.
This commit is contained in:
amithkoujalgi 2025-03-11 09:29:57 +05:30
parent b795117f0a
commit 7756eed9a0
No known key found for this signature in database
GPG Key ID: E29A37746AF94B70

36
pre-commit-config.yaml Normal file
View File

@ -0,0 +1,36 @@
repos:
# pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
hooks:
- id: check-added-large-files
- id: no-commit-to-branch
- id: check-toml
- id: check-yaml
- id: check-json
- id: check-xml
- id: end-of-file-fixer
exclude: \.json$
files: \.py$
- id: trailing-whitespace
- id: mixed-line-ending
# for commit message formatting
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.1.1
hooks:
- id: commitizen
stages: [commit-msg]
# for java code quality
- repo: https://github.com/gherynos/pre-commit-java
rev: v0.2.1
hooks:
- id: pmd
exclude: /test/
- id: cpd
exclude: /test/
- id: checkstyle
exclude: /test/
# ...