Skip to content

Commit

Permalink
DX: switch to issue forms
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Sep 28, 2023
1 parent 21cc670 commit 49c9204
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 153 deletions.
32 changes: 0 additions & 32 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

22 changes: 0 additions & 22 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

11 changes: 0 additions & 11 deletions .github/pull_request_template.md

This file was deleted.

10 changes: 7 additions & 3 deletions src/repoma/check_dev_files/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
cspell,
editorconfig,
github_labels,
github_templates,
github_workflows,
gitpod,
mypy,
Expand Down Expand Up @@ -65,6 +64,12 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
required=False,
type=str,
)
parser.add_argument(
"--keep-issue-templates",
help="Do not remove the .github/ISSUE_TEMPLATE directory",
action="store_true",
default=False,
)
parser.add_argument(
"--ignore-author",
action="store_true",
Expand Down Expand Up @@ -165,7 +170,6 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
executor(editorconfig.main, args.no_python)
if not args.allow_labels:
executor(github_labels.main)
executor(github_templates.main)
executor(
github_workflows.main,
allow_deprecated=args.allow_deprecated_workflows,
Expand Down Expand Up @@ -194,7 +198,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
executor(pyupgrade.main)
executor(ruff.main)
executor(setup_cfg.main, args.ignore_author)
executor(remove_deprecated_tools)
executor(remove_deprecated_tools, args.keep_issue_templates)
executor(vscode.main)
if not args.no_gitpod:
executor(gitpod.main)
Expand Down
19 changes: 17 additions & 2 deletions src/repoma/check_dev_files/deprecated.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Remove deprecated linters and formatters."""
import os
import shutil
from typing import TYPE_CHECKING, List

from repoma.errors import PrecommitError
Expand All @@ -18,10 +19,12 @@
from tomlkit.items import Table


def remove_deprecated_tools() -> None:
def remove_deprecated_tools(keep_issue_templates: bool) -> None:
executor = Executor()
executor(_remove_flake8)
executor(_remove_isort)
if not keep_issue_templates:
executor(_remove_github_issue_templates)
executor(_remove_pydocstyle)
executor(_remove_pylint)
executor.finalize()
Expand Down Expand Up @@ -85,6 +88,15 @@ def __remove_nbqa_option(option: str) -> None:
raise PrecommitError(msg)


def _remove_github_issue_templates() -> None:
__remove_configs(
[
".github/ISSUE_TEMPLATE",
".github/pull_request_template.md",
]
)


def _remove_pydocstyle() -> None:
executor = Executor()
executor(
Expand Down Expand Up @@ -122,7 +134,10 @@ def __remove_configs(paths: List[str]) -> None:
def __remove_file(path: str) -> None:
if not os.path.exists(path):
return
os.remove(path)
if os.path.isdir(path):
shutil.rmtree(path)
else:
os.remove(path)
msg = f"Removed {path}"
raise PrecommitError(msg)

Expand Down
83 changes: 0 additions & 83 deletions src/repoma/check_dev_files/github_templates.py

This file was deleted.

0 comments on commit 49c9204

Please sign in to comment.