From 7756eed9a07061c0c406949927b0c68b7f4eb284 Mon Sep 17 00:00:00 2001 From: amithkoujalgi Date: Tue, 11 Mar 2025 09:29:57 +0530 Subject: [PATCH] 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. --- pre-commit-config.yaml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pre-commit-config.yaml diff --git a/pre-commit-config.yaml b/pre-commit-config.yaml new file mode 100644 index 0000000..839c949 --- /dev/null +++ b/pre-commit-config.yaml @@ -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/ + # ... \ No newline at end of file