Skip to content

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

Closed
Vierkantor wants to merge 2 commits intomasterfrom
shake-messages
Closed

[Merged by Bors] - feat(Shake): output clarifications#9996
Vierkantor wants to merge 2 commits intomasterfrom
shake-messages

Conversation

@Vierkantor
Copy link
Copy Markdown
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
Copy Markdown
Contributor

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@kim-em kim-em added awaiting-review awaiting-author A reviewer has asked the author a question or requested changes. labels Jan 30, 2024
@kim-em
Copy link
Copy Markdown
Contributor

kim-em commented Jan 30, 2024

bors d+

@mathlib-bors
Copy link
Copy Markdown
Contributor

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 This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed awaiting-review labels Jan 30, 2024
That way we don't say "All edits applied." if there were none
@Vierkantor
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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
-- 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 This pull request has been delegated to the PR author (or occasionally another non-maintainer). ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants