https://github.com/open-mmlab/pre-commit-hooks
https://github.com/open-mmlab/pre-commit-hooks
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/open-mmlab/pre-commit-hooks
- Owner: open-mmlab
- License: apache-2.0
- Created: 2021-12-17T06:59:38.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-10T08:41:34.000Z (over 2 years ago)
- Last Synced: 2025-04-05T11:34:22.007Z (2 months ago)
- Language: Python
- Size: 34.2 KB
- Stars: 17
- Watchers: 6
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pre-commit-hooks
Some pre-commit hooks for OpenMMLab projects.
## Using pre-commit-hooks with pre-commit
Add this to your `.pre-commit-config.yaml`
```yaml
- repo: https://github.com/open-mmlab/pre-commit-hooks
rev: v0.4.1 # Use the ref you want to point at
hooks:
- id: check-algo-readme
- id: check-copyright
args: ["dir_to_check"] # replace the dir_to_check with your expected directory to check
- id: check-ecosystem-validity
args: [projects_index.yaml]
additional_dependencies:
- cerberus
- id: remove-improper-eol-in-cn-docs
```## Hooks available
### say-hello
A template to show how to implement a pre-commit hook
### check-algo-readme
Check whether the abstract and icon exist in the algorithm readme.
- `--debug` - print details of abstract and icon in dict format.
- `--dry-run` - just dry run, igonre failed use case.
- `--model-index ${MODEL_INDEX}` - custom model-index file path.### check-copyright
Check whether the code contains copyright
- `includes` - directory to add copyright.
- `--excludes` - exclude directory.
- `--suffixes` - copyright will be added to files with suffix.
- `--ignore-file-not-found-error` - Whether to ignore `FileNotFoundError` when some directories are specified to add copyright but they are not found.### check-ecosystem-validity
Check the validity of the ecosystem yaml file
- `filename` - path of the project yaml
```yaml
- repo: https://github.com/open-mmlab/pre-commit-hooks
rev: v0.4.1
hooks:
- id: check-ecosystem-validity
args: [projects_index.yaml]
additional_dependencies:
- cerberus
```### remove-improper-eol-in-cn-docs
Remove end-of-line characters that split natural paragraphs in Chinese docs.
This helps resolve extra whitespaces in Chinese Markdown docs described [here](https://stackoverflow.com/questions/8550112/prevent-workaround-browser-converting-n-between-lines-into-space-for-chinese/8551033#8551033), as a long-standing HTML rendering issue. For example,
> 这是一个,
> 像诗一样的
> 测试will be changed to:
> 这是一个,像诗一样的测试
Usage:
```yaml
- repo: https://github.com/open-mmlab/pre-commit-hooks
rev: v0.4.1
hooks:
- id: remove-improper-eol-in-cn-docs
```