Some pre-commit hooks for OpenMMLab projects.
Add this to your .pre-commit-config.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
A template to show how to implement a pre-commit hook
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 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 ignoreFileNotFoundError
when some directories are specified to add copyright but they are not found.
Check the validity of the ecosystem yaml file
filename
- path of the project 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 end-of-line characters that split natural paragraphs in Chinese docs.
This helps resolve extra whitespaces in Chinese Markdown docs described here, as a long-standing HTML rendering issue. For example,
这是一个, 像诗一样的 测试
will be changed to:
这是一个,像诗一样的测试
Usage:
- repo: https://github.com/open-mmlab/pre-commit-hooks
rev: v0.4.1
hooks:
- id: remove-improper-eol-in-cn-docs