Skip to content

Commit

Permalink
ENH: remove GitPod config if --no-gitpod (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer authored Oct 6, 2023
1 parent 69a1a12 commit 5f4f7b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/repoma/check_dev_files/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)


def main(argv: Optional[Sequence[str]] = None) -> int: # noqa: PLR0915
def main(argv: Optional[Sequence[str]] = None) -> int:
parser = argparse.ArgumentParser(__doc__)
parser.add_argument(
"--allow-deprecated-workflows",
Expand Down Expand Up @@ -200,8 +200,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int: # noqa: PLR0915
executor(setup_cfg.main, args.ignore_author)
executor(remove_deprecated_tools, args.keep_issue_templates)
executor(vscode.main, has_notebooks)
if not args.no_gitpod:
executor(gitpod.main)
executor(gitpod.main, args.no_gitpod)
executor(precommit.main)
return executor.finalize(exception=False)

Expand Down
8 changes: 7 additions & 1 deletion src/repoma/check_dev_files/gitpod.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
__CONSTRAINTS_FILE = ".constraints/py3.8.txt"


def main() -> None:
def main(no_gitpod: bool) -> None:
if no_gitpod:
if CONFIG_PATH.gitpod.exists():
os.remove(CONFIG_PATH.gitpod)
msg = f"Removed {CONFIG_PATH.gitpod} as requested by --no-gitpod"
raise PrecommitError(msg)
return
pin_dependencies = os.path.exists(__CONSTRAINTS_FILE)
error_message = ""
expected_config = _generate_gitpod_config(pin_dependencies)
Expand Down

0 comments on commit 5f4f7b1

Please sign in to comment.