Skip to content

[Merged by Bors] - chore: move lint_style executable to the scripts directory#14057

Closed
grunweg wants to merge 1 commit intomasterfrom
MR-move-lintstyle
Closed

[Merged by Bors] - chore: move lint_style executable to the scripts directory#14057
grunweg wants to merge 1 commit intomasterfrom
MR-move-lintstyle

Conversation

@grunweg
Copy link
Copy Markdown
Contributor

@grunweg grunweg commented Jun 23, 2024

Otherwise, importing Mathlib.Tactic makes defining own executables impossible, as the main function in Linter.TextBased would collide with any other main function. Move the code for the lint_style executable to scripts (which arguably might be a better place anyway); we leave the text-based linters in Tactic/Linter.


Open in Gitpod

Otherwise, importing `Mathlib.Tactic` makes defining own executables impossible,
as the `main` function in `Linter.TextBased` would collide with any other main function.
Move the code for the lint_style executable to scripts (which arguably might be a better place anyway);
we leave the text-based linters in Tactic/Linter.
@github-actions
Copy link
Copy Markdown

PR summary 5e2a43cf4c

Import changes

Dependency changes

File Base Count Head Count Change
Mathlib.Tactic.Linter.TextBased 3 2 -1 (-33.33%)

Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## summary with just the declaration names:
./scripts/no_lost_declarations.sh short <optional_commit>

## more verbose report:
./scripts/no_lost_declarations.sh <optional_commit>

@eric-wieser
Copy link
Copy Markdown
Member

maintainer merge

LGTM, but let's get a second pair of eyes.

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by eric-wieser.

@github-actions github-actions bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Jun 23, 2024
for s in ["Archive.lean", "Counterexamples.lean", "Mathlib.lean"] do
let n ← lintAllFiles (System.mkFilePath [s]) errorStyle
numberErrorFiles := numberErrorFiles + n
return numberErrorFiles
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.

Does this end up being the exit code of the function? Should the value make sure that it is not a non-zero multiple of 256, to avoid returning 0 when in reality there is an error?

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.

Good catch, in principle!
In practice, I don't think this issue is likely: UInt8 overflows at 256, but UInt32 like this and the other functions return overflows at 2^32. I think at this point, we'll have other problems... so I'll approve this for now. I you think this requires fixing, let me know and I'll change it in a follow-up!

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.

I am quite outside of my comfort zone here, but isn't this number reported back to the shell? I think that there, reduction mod 256 still happens:

$ ( exit 255 ); echo $?
255

$ ( exit 256 ); echo $?
0

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.

Oh, that is a good point. (I wasn't aware of this detail about shell exit codes... TIL!) A quick search confirms that limiting to an exit code of at most 125 is the safest option.
https://unix.stackexchange.com/questions/418784/what-is-the-min-and-max-values-of-exit-codes-in-linux

Let me send a follow-up PR soon, and adapt mk_all at the same time.

@kim-em
Copy link
Copy Markdown
Contributor

kim-em commented Jun 24, 2024

bors d+

Please fix the exit code issue, but otherwise LGTM!

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 24, 2024

✌️ grunweg 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 Jun 24, 2024
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jun 24, 2024

Thanks for the review! Per my comment above, let me
bors r+

mathlib-bors bot pushed a commit that referenced this pull request Jun 24, 2024
Otherwise, importing `Mathlib.Tactic` makes defining own executables impossible, as the `main` function in `Linter.TextBased` would collide with any other main function. Move the code for the lint_style executable to scripts (which arguably might be a better place anyway); we leave the text-based linters in Tactic/Linter.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 24, 2024

Build failed (retrying...):

mathlib-bors bot pushed a commit that referenced this pull request Jun 24, 2024
Otherwise, importing `Mathlib.Tactic` makes defining own executables impossible, as the `main` function in `Linter.TextBased` would collide with any other main function. Move the code for the lint_style executable to scripts (which arguably might be a better place anyway); we leave the text-based linters in Tactic/Linter.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 24, 2024

This PR was included in a batch that was canceled, it will be automatically retried

mathlib-bors bot pushed a commit that referenced this pull request Jun 24, 2024
Otherwise, importing `Mathlib.Tactic` makes defining own executables impossible, as the `main` function in `Linter.TextBased` would collide with any other main function. Move the code for the lint_style executable to scripts (which arguably might be a better place anyway); we leave the text-based linters in Tactic/Linter.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 24, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore: move lint_style executable to the scripts directory [Merged by Bors] - chore: move lint_style executable to the scripts directory Jun 24, 2024
@mathlib-bors mathlib-bors bot closed this Jun 24, 2024
@mathlib-bors mathlib-bors bot deleted the MR-move-lintstyle branch June 24, 2024 12:36
kbuzzard pushed a commit that referenced this pull request Jun 26, 2024
Otherwise, importing `Mathlib.Tactic` makes defining own executables impossible, as the `main` function in `Linter.TextBased` would collide with any other main function. Move the code for the lint_style executable to scripts (which arguably might be a better place anyway); we leave the text-based linters in Tactic/Linter.
dagurtomas pushed a commit that referenced this pull request Jul 2, 2024
Otherwise, importing `Mathlib.Tactic` makes defining own executables impossible, as the `main` function in `Linter.TextBased` would collide with any other main function. Move the code for the lint_style executable to scripts (which arguably might be a better place anyway); we leave the text-based linters in Tactic/Linter.
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). maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. t-linter Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants