Skip to content

Commit

Permalink
refactor: better var naming in hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-jakub-cierocki committed Jul 23, 2024
1 parent 1548f5b commit f7ba881
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

print("Running post generation...")

remove_paths = []
files_to_be_removed = []

GITLAB_FILES = [
".gitlab-ci.yml",
Expand All @@ -31,31 +31,31 @@
]

{% if cookiecutter.ci != "GitLab" %}
remove_paths.extend(GITLAB_FILES)
files_to_be_removed.extend(GITLAB_FILES)
{% endif %}

{% if cookiecutter.ci != "Github" %}
remove_paths.extend(GITHUB_FILES)
files_to_be_removed.extend(GITHUB_FILES)
{% endif %}

{% if cookiecutter.jupytext != "Yes" %}
remove_paths.append("notebooks/example.py")
files_to_be_removed.append("notebooks/example.py")
{% endif %}

{% if cookiecutter.docs == "No docs" %}
remove_paths.extend(DOCS_FILES)
files_to_be_removed.extend(DOCS_FILES)
{% endif %}

{% if cookiecutter.versioning != "Bumpversion" %}
remove_paths.extend(BUMPVERSION_FILES)
files_to_be_removed.extend(BUMPVERSION_FILES)
{% endif %}

{% if cookiecutter.versioning != "Python Semantic Release" %}
remove_paths.extend(SEMANTIC_RELEASE_FILES)
files_to_be_removed.extend(SEMANTIC_RELEASE_FILES)
{% endif %}

print("Cleaning files... 🌀")
for path in remove_paths:
for path in files_to_be_removed:
path = Path(path)
if path.exists() and path.is_file():
print(f"Clean up file: '{path}'")
Expand Down

0 comments on commit f7ba881

Please sign in to comment.