Skip to content

Commit

Permalink
Add pre-commit to the package to be installed
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaprieto committed Oct 17, 2024
1 parent db29109 commit c6a618d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,27 @@ def install_poetry_package(package_name, skip_flag=False, development_flag=False
]
for plugin in rest_of_plugins:
install_poetry_package(plugin)

except Exception:
return

if not no_interactive:
install_pre_commit = questionary.confirm(
"Install pre-commit? (recommended)", default=install_pre_commit
).ask()
if install_pre_commit:
install_poetry_package("pre-commit")
# move the pre-commit config to the project path
pre_commit_file = project_path / ".pre-commit-config.yaml"
if not pre_commit_file.exists() or force:
pre_commit_file.write_text(
(FIXTURES_PATH / ".pre-commit-config.yaml").read_text()
)
click.secho("Done.", fg="green")
else:
click.secho(
"File already exists. Use -f to force overwrite.", fg="yellow"
)

try:
if not no_bibtex:
install_poetry_package("mkdocs-bibtex")
Expand Down
20 changes: 20 additions & 0 deletions src/fixtures/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: ^[art.bib|mkdocs]*
- id: check-added-large-files
- id: debug-statements
- id: detect-private-key
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: forbid-binary
exclude_types: [png]
exclude: docs/assets/|docs/overrides/
- repo: https://github.com/google/yamlfmt
rev: v0.13.0
hooks:
- id: yamlfmt

0 comments on commit c6a618d

Please sign in to comment.