File tree Expand file tree Collapse file tree
{% if AddPreCommit %}.githhooks{% endif %} Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515
1616### Changed
1717
18+ * pre-commit script is optional ([ #457 ] ( https://github.com/NLeSC/python-template/issues/457 ) )
1819* CHANGELOG.md is now optional ([ #462 ] ( https://github.com/NLeSC/python-template/issues/462 ) )
1920* Moved to src/ based layout for generated packages
2021* Moved from setup.cfg/.py to pyproject.toml [ #351 ] ( https://github.com/NLeSC/python-template/issues/351 )
Original file line number Diff line number Diff line change @@ -101,6 +101,12 @@ AddOnlineDocumentation:
101101 default : " {{ template_profile != 'minimum' }}"
102102 help : Online documentation using Read the Docs
103103
104+ AddPreCommit :
105+ when : " {{ template_profile == 'ask' }}"
106+ type : bool
107+ default : " {{ template_profile != 'minimum' }}"
108+ help : Add pre-commit hook to check code style and format on every commit?
109+
104110# internal fields
105111_subdirectory : template
106112
Original file line number Diff line number Diff line change @@ -77,11 +77,13 @@ ruff . --fix
7777
7878To fix readability of your code style you can use [yapf](https://github.com/google/yapf).
7979
80+ {% - if AddPreCommit -%}
8081You can enable automatic linting with `ruff` on commit by enabling the git hook from `.githooks/pre-commit`, like so:
8182
8283```shell
8384git config --local core.hooksPath .githooks
8485```
86+ {% - endif -%}
8587
8688## Generating the API docs
8789
File renamed without changes.
You can’t perform that action at this time.
0 commit comments