Skip to content

Commit 1d454b0

Browse files
authored
Merge pull request #487 from NLeSC/457-optional-precommit
Make pre-commit optional
2 parents aa7326f + a5ad458 commit 1d454b0

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
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)

copier.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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

template/README.dev.md.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,13 @@ ruff . --fix
7777

7878
To fix readability of your code style you can use [yapf](https://github.com/google/yapf).
7979

80+
{%- if AddPreCommit -%}
8081
You can enable automatic linting with `ruff` on commit by enabling the git hook from `.githooks/pre-commit`, like so:
8182

8283
```shell
8384
git config --local core.hooksPath .githooks
8485
```
86+
{%- endif -%}
8587

8688
## Generating the API docs
8789

0 commit comments

Comments
 (0)