Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: warn user about bad pattern paths before skipping step git #456

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

SteveLauC
Copy link
Member

Standards checklist:

  • The PR title is descriptive.
  • I have read CONTRIBUTING.md
  • The code compiles (cargo build)
  • The code passes rustfmt (cargo fmt)
  • The code passes clippy (cargo clippy)
  • The code passes tests (cargo test)
  • Optional: I have tested the code myself
    • I also tested that Topgrade skips the step where needed

If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.


We should warn the user about the bad pattern before skipping the step git:

$ cat ~/.config/topgrade/topgrade.toml
[git]
pull_predefined = false
repos = [
    "bad_pattern"
]

# No warning at all because all my configured paths are invalid, and thus 
# `Repositories.repositories` `is_empty()`, the git step is skipped
$ topgrade --dry-run --only git_repos
$ echo $?
0

$ ./target/debug/topgrade --dry-run --only git_repos
Path bad_pattern did not contain any git repositories

I think besides Skipped, we should define another state NotFound, when a step's binary is not found in $PATH, we use NotFound to skip this step instead of Skipped. For the case where the binary is found but some conditions are not satisfied during execution (e.g., for git step, no repo is found, like the case described in this PR), we use Skipped.

And for a Skipped step, a separator should be printed and a warning should be given to the user telling the user why this step was skipped. For a NotFound step, we don't need to print a separator as users don't use it at all.

@s34m s34m merged commit 7e48c5d into topgrade-rs:master Jun 1, 2023
@SteveLauC SteveLauC deleted the git-bad-pattern-warn branch June 1, 2023 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants