-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add pre-commit hooks and format existing code
This commit introduces pre-commit hooks to ensure that Python and Rust code adheres to the specified style guidelines and quality standards. The following hooks have been added to the .pre-commit-config.yaml file: - pre-commit-hooks: - trailing-whitespace: Removes trailing whitespace - end-of-file-fixer: Ensures files end with a newline - check-yaml: Validates YAML files - check-json: Validates JSON files - check-added-large-files: Prevents large files from being added - check-merge-conflict: Detects merge conflict markers - black: - Formats Python code according to Black's style guide with a max line length of 120 characters - flake8: - Lints Python code with Flake8 and flake8-bugbear plugin, ignoring F401 errors and allowing a max line length of 120 characters - Mypy: - Performs static type checking on Python code, ignoring missing imports with --ignore-missing-imports flag - local: - cargo fmt: Formats Rust code using These hooks will run automatically before each commit, helping to maintain a consistent code style and quality across the project. Additionally, this commit reformats the current codebase to comply with the new style guidelines enforced by the pre-commit hooks. BREAKING CHANGE: Developers must now have pre-commit installed and configured to contribute to the project.
- Loading branch information
yanghao14
committed
Jul 27, 2024
1 parent
36316e0
commit 9dbd569
Showing
4 changed files
with
130 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-json | ||
- id: check-added-large-files | ||
- id: check-merge-conflict | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.4.2 | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
args: ["--line-length", "120"] | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 7.1.0 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [flake8-bugbear] | ||
args: ["--max-line-length", "120", "--ignore=F401"] | ||
|
||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.11.0 | ||
hooks: | ||
- id: mypy | ||
args: [ "--ignore-missing-imports" ] | ||
|
||
- repo: local | ||
hooks: | ||
- id: cargo-fmt | ||
name: cargo fmt | ||
entry: cargo fmt -- | ||
language: system | ||
types: [rust] | ||
pass_filenames: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters