Skip to content

Fix parser warnings order#11479

Open
omarjatoi wants to merge 1 commit into
haskell:masterfrom
omarjatoi:11269-warnings-in-reverse
Open

Fix parser warnings order#11479
omarjatoi wants to merge 1 commit into
haskell:masterfrom
omarjatoi:11269-warnings-in-reverse

Conversation

@omarjatoi
Copy link
Copy Markdown

See #11269 for more information. This PR changes the parse results to append warnings so they're displayed in-order.


This PR modifies behaviour or interface

Include the following checklist in your PR:

Copy link
Copy Markdown
Collaborator

@geekosaur geekosaur left a comment

Choose a reason for hiding this comment

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

Fine aside from the missing field in the changelog.

@omarjatoi
Copy link
Copy Markdown
Author

Thanks! Let me get that fixed.

@omarjatoi omarjatoi force-pushed the 11269-warnings-in-reverse branch from 7d06af6 to 65195c4 Compare February 7, 2026 19:45
@geekosaur
Copy link
Copy Markdown
Collaborator

I do wonder if just doing a reverse at the end would be better, but on the other hand if they have enough warnings for that to make a significant difference then they have bigger problems than warning collection. 😁

@omarjatoi
Copy link
Copy Markdown
Author

Yeah I thought of doing that at first, and figured it maybe made sense to just return the warnings in the correct order instead of having to reverse them. But I do not feel strongly, if that's preferred I'd be happy to make that change.

@geekosaur
Copy link
Copy Markdown
Collaborator

No, I don't think it's really necessary. The downside of xs ++ [x] is that it has to traverse xs, but again if they have that many warnings that this shows, they have bigger problems.

@omarjatoi
Copy link
Copy Markdown
Author

Just wondering if I need to be looking at those 'Validate' CI failures more closely. At least some of the failures seem to be flakes. Let me know if there's anything else I can look into to request a second approval to merge!

@geekosaur
Copy link
Copy Markdown
Collaborator

The first one I opened has a newly reversed warning.

          --- encoding-0.8.cabal:1:1: The field "name" is specified more than once at positions 1:1, 2:1
              encoding-0.8.cabal:4:22: Packages with 'cabal-version: 1.12' or later should specify a specific version of the Cabal spec of the form 'cabal-version: x.y'. Use 'cabal-version: 1.12'.
          +++ encoding-0.8.cabal:1:1: The field "name" is specified more than once at positions 1:1, 2:1

@omarjatoi
Copy link
Copy Markdown
Author

The first one I opened has a newly reversed warning.


          --- encoding-0.8.cabal:1:1: The field "name" is specified more than once at positions 1:1, 2:1

              encoding-0.8.cabal:4:22: Packages with 'cabal-version: 1.12' or later should specify a specific version of the Cabal spec of the form 'cabal-version: x.y'. Use 'cabal-version: 1.12'.

          +++ encoding-0.8.cabal:1:1: The field "name" is specified more than once at positions 1:1, 2:1

Ah okay, thanks -- I'll take a look at these

@philderbeast
Copy link
Copy Markdown
Collaborator

@omarjatoi could you please rebase this on master?

@omarjatoi omarjatoi force-pushed the 11269-warnings-in-reverse branch from 22a3071 to 6ecd9c2 Compare May 23, 2026 13:50
@omarjatoi
Copy link
Copy Markdown
Author

omarjatoi commented May 23, 2026

I've rebased, but after investigating some of the errors it seems that we parse the cabal-version first, and then the rest of the fields, so this approach still fails when there's a warning for the cabal-version field, e.g. in encoding-0.8.cabal.format

I created another branch with an approach that sorts by position (see: omarjatoi@8caeb97) which gets us what we want in all cases, I'm open to feedback on whether or not that approach makes sense. If yes, I'm happy to apply that in this PR.

EDIT: I've pushed 98697f1 to this branch to let CI run, if this looks good I'll squash my commits and clean up the PR description.

Comment thread changelog.d/issue-11269.md Outdated
@omarjatoi omarjatoi force-pushed the 11269-warnings-in-reverse branch 2 times, most recently from f2f4600 to 60d962c Compare May 24, 2026 13:51
@omarjatoi omarjatoi requested a review from geekosaur May 24, 2026 13:54
@omarjatoi
Copy link
Copy Markdown
Author

Ok that did give us a successful CI run, I've squashed the changes into a single commit now. @geekosaur, I re-requested a review since I've changed the implementation since you approved, please take a look.

Thanks!

@zlonast zlonast linked an issue May 24, 2026 that may be closed by this pull request
@zlonast
Copy link
Copy Markdown
Collaborator

zlonast commented May 24, 2026

Hi @omarjatoi, CI is a bit bad, can you rebase?

@omarjatoi omarjatoi force-pushed the 11269-warnings-in-reverse branch from 60d962c to 8b25b55 Compare May 24, 2026 20:39
@omarjatoi
Copy link
Copy Markdown
Author

omarjatoi commented May 24, 2026

Hi @omarjatoi, CI is a bit bad, can you rebase?

done, thanks for the heads up!

See haskell#11269 for more information. This PR sorts the parse results by position so they're displayed in file order.

Resolves: haskell#11269
@omarjatoi omarjatoi force-pushed the 11269-warnings-in-reverse branch from 8b25b55 to 2b6459c Compare May 25, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning is emitted in reverse

4 participants