Added pre-commit hooks support (#1138)#1149
Added pre-commit hooks support (#1138)#1149gvatsal60 wants to merge 6 commits intodevcontainers:mainfrom
Conversation
16be955 to
0425c3a
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces pre-commit hooks support to the repository by adding a .pre-commit-config.yaml configuration file. The configuration includes various linting and validation hooks, though most are currently commented out to allow for incremental adoption.
Key changes:
- Added
.pre-commit-config.yamlwith hook configurations for file checks, linting, formatting, and security scanning - Most hooks are commented out to minimize initial impact and allow gradual enablement
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,70 @@ | |||
| repos: | |||
There was a problem hiding this comment.
The indentation at the start of this file is incorrect. The "repos:" key should have no leading spaces. Currently, it has 2 leading spaces which will cause YAML parsing errors.
| repos: | ||
| # Syncs pre-commit dependencies with the latest versions. | ||
| - repo: https://github.com/mxr/sync-pre-commit-deps | ||
| rev: "v0.0.1" |
There was a problem hiding this comment.
The version for the sync-pre-commit-deps hook appears to be very old (v0.0.1). This is the initial release and may not be stable or feature-complete. Consider using a more recent stable version to ensure better reliability and functionality.
| rev: "v0.0.1" | |
| rev: "v0.0.5" |
| # - id: check-vcs-permalinks | ||
| # - id: check-yaml | ||
| # - id: destroyed-symlinks | ||
| # - id: detect-private-key |
There was a problem hiding this comment.
The commented-out detect-private-key hook should be enabled to prevent accidentally committing sensitive information like private keys to the repository. This is a critical security feature that should be active, especially in a project that will be shared or made public.
| # - id: detect-private-key | |
| - id: detect-private-key |
| # - id: end-of-file-fixer | ||
| # - id: fix-byte-order-marker | ||
| # - id: mixed-line-ending | ||
| # - id: pretty-format-json | ||
| # args: [--autofix, --no-sort-keys] | ||
| # - id: trailing-whitespace |
There was a problem hiding this comment.
The end-of-file-fixer and trailing-whitespace hooks should be enabled to maintain consistent formatting across the codebase. These are low-impact hooks that automatically fix common formatting issues and help maintain code quality standards without requiring significant modifications.
| # - id: end-of-file-fixer | |
| # - id: fix-byte-order-marker | |
| # - id: mixed-line-ending | |
| # - id: pretty-format-json | |
| # args: [--autofix, --no-sort-keys] | |
| # - id: trailing-whitespace | |
| - id: end-of-file-fixer | |
| # - id: fix-byte-order-marker | |
| # - id: mixed-line-ending | |
| # - id: pretty-format-json | |
| # args: [--autofix, --no-sort-keys] | |
| - id: trailing-whitespace |
Issue #1138
Changes Made
devcontainer.json:
Introduced the
.pre-commit-config.yamlfile containing hooks. Currently, the hooks are commented out, as enabling them will require significant modifications. It may be beneficial to enable them incrementally.Some work still remains to enhance robustness and usability.