Skip to content

Commit

Permalink
ENH: remove GitPod config if --no-gitpod
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Oct 6, 2023
1 parent 69a1a12 commit fa69b99
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)

Check warning on line 203 in src/repoma/check_dev_files/__init__.py

View check run for this annotation

Codecov / codecov/patch

src/repoma/check_dev_files/__init__.py#L203

Added line #L203 was not covered by tests
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

Check warning on line 23 in src/repoma/check_dev_files/gitpod.py

View check run for this annotation

Codecov / codecov/patch

src/repoma/check_dev_files/gitpod.py#L20-L23

Added lines #L20 - L23 were not covered by tests
pin_dependencies = os.path.exists(__CONSTRAINTS_FILE)
error_message = ""
expected_config = _generate_gitpod_config(pin_dependencies)
Expand Down

0 comments on commit fa69b99

Please sign in to comment.