feat: add pre-commit hooks configuration with pyink and pylint #462
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive pre-commit hooks setup to automate code quality checks and maintain consistent style across contributions. This feature was requested and approved by maintainers in issue #448.
Motivation
From issue #448:
Benefits:
Changes
1.
.pre-commit-config.yaml(NEW)Comprehensive pre-commit configuration including:
Standard hooks:
trailing-whitespace: Remove trailing whitespaceend-of-file-fixer: Ensure files end with newlinecheck-yaml/toml/json: Validate config filescheck-added-large-files: Prevent large file commits (>1MB)check-merge-conflict: Detect merge conflict markerscheck-case-conflict: Catch case-sensitivity issuesmixed-line-ending: Normalize line endings to LFdebug-statements: Prevent debug code commitsPython code formatting (pyink):
Python linting (pylint):
.pylintrcconfiguration2.
CONTRIBUTING.md(UPDATED)Added comprehensive "Development Environment Setup" section with:
Installation instructions:
Usage guidelines:
What gets checked:
Testing
Pre-commit hooks tested locally:
Results:
Test commands:
Configuration Details
pyink settings (matches
pyproject.toml):pylint settings:
.pylintrcImpact
--no-verify)Compatibility
pip install pre-commit(documented in CONTRIBUTING.md)Documentation
Checklist
Future Enhancements
Potential additions for future PRs:
mypyfor static type checkingisortfor import sortingbanditfor security checks