Skip to content

Tidy should not check line lengths in UI tests #77548

Closed

Description

@RalfJung

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?

Activity

  1. added
    A-testsuiteArea: The testsuite used to check the correctness of rustc
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    on Oct 4, 2020
  2. Mark-Simulacrum commented on Oct 4, 2020

    @Mark-Simulacrum
    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.

  3. added
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
    on Oct 4, 2020
  4. added
    A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to Rust
    on Oct 5, 2020
  5. Anthuang commented on Oct 7, 2020

    @Anthuang
    Contributor

    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?

  6. Mark-Simulacrum commented on Oct 7, 2020

    @Mark-Simulacrum
    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.

  7. added 2 commits that reference this issue on Nov 19, 2020
    3034209
    956135c
  8. sjakobi commented on Mar 26, 2021

    @sjakobi
    Contributor

    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.

  9. RalfJung commented on Mar 26, 2021

    @RalfJung
    MemberAuthor

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

  10. sjakobi commented on Mar 27, 2021

    @sjakobi
    Contributor

    @rustbot claim

  11. added a commit that references this issue on Apr 3, 2021
  12. added 2 commits that reference this issue on Apr 4, 2021
  13. added a commit that references this issue on Apr 11, 2021
    761ef8f
  14. added a commit that references this issue on Apr 11, 2021
    3f8adde
  15. RalfJung commented on Apr 12, 2021

    @RalfJung
    MemberAuthor

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

  16. sjakobi commented on Apr 12, 2021

    @sjakobi
    Contributor

    @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

Metadata

Metadata

Assignees

Labels

A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustA-testsuiteArea: The testsuite used to check the correctness of rustcC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions