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

Tidy should not check line lengths in UI tests #77548

Closed
RalfJung opened this issue Oct 4, 2020 · 8 comments · Fixed by #84100
Closed

Tidy should not check line lengths in UI tests #77548

RalfJung opened this issue Oct 4, 2020 · 8 comments · Fixed by #84100
Assignees
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@RalfJung
Copy link
Member

RalfJung commented Oct 4, 2020

UI tests regularly have long lines due to the //~ ERROR annotations. So it is not very helpful for tidy to complain about overly long lines... every single time that happened, I ended up adding // ignore-tidy-linelength (the amount of time it took me to figure out the exact way to do this went down from 3-5min the first time to <20s by now). To make test maintenance even more annoying, when an error message changes to become shorter, tidy will complain about the ignore flag being unnecessary! And each time the flag is added or removed, you need to re-bless the tests as line numbers change.

This chore doesn't really seem worth it. We don't rustfmt the test suite either. Can we just disable the line length checker in the test suite please?

@jonas-schievink jonas-schievink added A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Oct 4, 2020
@Mark-Simulacrum
Copy link
Member

We can add a check similar to https://github.com/rust-lang/rust/blob/master/src/tools/tidy/src/style.rs#L171 to disable just the line length limits for UI tests.

@Mark-Simulacrum Mark-Simulacrum added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Oct 4, 2020
@jyn514 jyn514 added the A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself label Oct 5, 2020
@Anthuang
Copy link
Contributor

Anthuang commented Oct 7, 2020

Hey, first time contributor here happy to give this a shot! I think I get what's going on here, but do you have any pointers for where I should be looking exactly?

@Mark-Simulacrum
Copy link
Member

I would add a "in_tests" check similar to the the under_rustfmt one here

let under_rustfmt = filename.ends_with(".rs") &&
, and then add it to the conditional here
if !under_rustfmt
to not run that lint in tests.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 19, 2020
…imulacrum

Tidy should not check line lengths in tests

Tidy will not check line lengths in tests even without the `// ignore-tidy-linelength` annotations. This PR also removes all the annotations which are now unnecessary.

Closes: rust-lang#77548
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 19, 2020
…imulacrum

Tidy should not check line lengths in tests

Tidy will not check line lengths in tests even without the `// ignore-tidy-linelength` annotations. This PR also removes all the annotations which are now unnecessary.

Closes: rust-lang#77548
@sjakobi
Copy link
Contributor

sjakobi commented Mar 26, 2021

Is the plan suggested in #77675 (comment) still good?

does it make sense to disable the "ignoring length unnecessarily" lint temporarily so this can land? Then once this lands people will stop adding the ignore and it will be easier to turn the lint back on.

@RalfJung
Copy link
Member Author

RalfJung commented Mar 26, 2021

@sjakobi yeah I'd say it is. #77675 actually did most of the work (adjusting tidy); someone just has to do the multi-stage landing process:

  • in a first PR, land the tidy change with disabled "ignoring length unnecessarily" (and probably adjust no existing tests, to keep conflicts down)
  • then in a second PR, remove the unnecessary ignore-line-length comments (probably still keeping "ignoring length unnecessarily" disabled as more tests will trickle in that still have the ignore-line-length flag)
  • after 2 weeks or so, re-enable the "ignoring length unnecessarily" test

Step 3 is assuming that we truly want to keep that check. I personally think it is somewhat silly, but I assume it was added because people want it, so maybe we should keep it.

@sjakobi
Copy link
Contributor

sjakobi commented Mar 27, 2021

@rustbot claim

sjakobi pushed a commit to sjakobi/rust that referenced this issue Apr 3, 2021
This is step 1 towards fixing rust-lang#77548.

This commit includes the tidy change from rust-lang#77675.
The "ignoring file length unnecessarily" check is temporarily
disabled to simplify landing the ignore-rules.
That check will be re-enabled in a follow-up PR.
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 3, 2021
…-Simulacrum

tidy: Add ignore-rules for the line length check

This is step 1 towards fixing rust-lang#77548.

This PR contains the `tidy` change from rust-lang#77675. The "ignoring file length unnecessarily" check is temporarily disabled to simplify landing the ignore-rules. This check will be re-enabled in a follow-up PR.
sjakobi added a commit to sjakobi/rust that referenced this issue Apr 3, 2021
This is step 2 towards fixing rust-lang#77548.

In the codegen and codegen-units test suites, the `//` comment markers
were kept in order not to affect any source locations. This is because
these tests cannot be automatically `--bless`ed.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 4, 2021
…ions, r=Mark-Simulacrum

Tests: Remove redundant `ignore-tidy-linelength` annotations

This is step 2 towards fixing rust-lang#77548.

In the codegen and codegen-units test suites, the `//` comment markers
were kept in order not to affect any source locations. This is because
these tests cannot be automatically `--bless`ed.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 4, 2021
…ions, r=Mark-Simulacrum

Tests: Remove redundant `ignore-tidy-linelength` annotations

This is step 2 towards fixing rust-lang#77548.

In the codegen and codegen-units test suites, the `//` comment markers
were kept in order not to affect any source locations. This is because
these tests cannot be automatically `--bless`ed.
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 11, 2021
tidy: Re-enable the "ignoring line length unnecessarily" check

Closes rust-lang#77548.
@bors bors closed this as completed in 761ef8f Apr 12, 2021
@RalfJung
Copy link
Member Author

@sjakobi thank you so much for pushing this through. :-)

@sjakobi
Copy link
Contributor

sjakobi commented Apr 12, 2021

@RalfJung Thanks to your quick advice and @Anthuang's great preparatory work this was in fact pretty easy. I'm very impressed by the tooling and automation surrounding the contribution process! 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
6 participants