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

[Merged by Bors] - feat(Shake): output clarifications #9996

Closed
wants to merge 2 commits into from

Conversation

Vierkantor
Copy link
Contributor

A new user running lake exe shake --fix will see lots of messages like "add:" "remove:" "fix:" and won't know what to do with it. I think these minor changes to the output will massively clarify what the tool actually wants you to do.


Open in Gitpod

A new user running `lake exe shake --fix` will see lots of messages like "add:" "remove:" "fix:" and won't know what to do with it. I think these minor changes to the output will massively clarify what the tool actually wants you to do.
Copy link
Collaborator

@grunweg grunweg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can certainly confirm that the changes make the output much clearer.

Other questions (such as "how will a user find out this exists, or know what it does, or discover the "--fix" flag) can be discussed after this PR.

@Vierkantor
Copy link
Contributor Author

Other questions (such as "how will a user find out this exists, or know what it does, or discover the "--fix" flag) can be discussed after this PR.

The command will run in CI and suggest running with the --fix flag: #9751 (which is why I think it's important to improve the UI now.)

Shake/Main.lean Outdated

-- Since we throw an error upon encountering issues, we can be sure that everything worked
-- if we reach this point of the script.
println!"All suggestions applied successfully."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably there should be a special case here in case the edit list is empty, e.g. No edits required. instead

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vierkantor, when you have a moment, do you want to make this change and then merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is the possibility that the edit list is nonempty but nothing gets applied, I ended up counting the number of edits in the edit-apply-loop.

@semorrison semorrison added awaiting-review The author would like community review of the PR awaiting-author A reviewer has asked the author a question or requested changes labels Jan 30, 2024
@semorrison
Copy link
Contributor

bors d+

@mathlib-bors
Copy link

mathlib-bors bot commented Jan 30, 2024

✌️ Vierkantor can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@github-actions github-actions bot added delegated and removed awaiting-review The author would like community review of the PR labels Jan 30, 2024
That way we don't say "All edits applied." if there were none
@Vierkantor
Copy link
Contributor Author

Although the change might have been larger than you might have expected, I'm going to be bold and say:

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-author A reviewer has asked the author a question or requested changes labels Feb 2, 2024
mathlib-bors bot pushed a commit that referenced this pull request Feb 2, 2024
A new user running `lake exe shake --fix` will see lots of messages like "add:" "remove:" "fix:" and won't know what to do with it. I think these minor changes to the output will massively clarify what the tool actually wants you to do.
@mathlib-bors
Copy link

mathlib-bors bot commented Feb 2, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Shake): output clarifications [Merged by Bors] - feat(Shake): output clarifications Feb 2, 2024
@mathlib-bors mathlib-bors bot closed this Feb 2, 2024
@mathlib-bors mathlib-bors bot deleted the shake-messages branch February 2, 2024 14:03
@@ -407,50 +410,60 @@ def main (args : List String) : IO Unit := do

-- Apply the edits to existing files
if !args.fix then return
edits.forM fun mod (remove, add) => do
let count ← edits.foldM (fun count mod (remove, add) => do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let count ← edits.foldM (fun count mod (remove, add) => do
let count ← edits.foldM (init := 0) fun count mod (remove, add) => do

I really hate it when the 0 argument is passed 40 lines later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea! Let me make a follow-up PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually don't worry about it, I've incorporated this into #9751

mathlib-bors bot pushed a commit that referenced this pull request Feb 2, 2024
- [X] depends on: #9830
- [X] depends on: #9772
- [X] depends on: #9996

This checks files for unused imports. The output here is piped through `gh-problem-matcher-wrap` so that it will show up as annotations.



Co-authored-by: Mario Carneiro <di.gama@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated ready-to-merge This PR has been sent to bors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants