Add source file to project parse errors and warnings#10644
Merged
mergify[bot] merged 1 commit intoJan 23, 2025
Conversation
7c990c9 to
a74ddc3
Compare
Collaborator
Author
|
@gbaz what are your concerns with the following comment and is there a test for this? cabal/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs Lines 175 to 176 in e562334 |
philderbeast
commented
Dec 16, 2024
deec1f5 to
6f5239b
Compare
geekosaur
approved these changes
Dec 16, 2024
6f5239b to
9f05ce2
Compare
Collaborator
Author
|
Reverting to draft while I settle some Windows versus POSIX file path issues. |
d45311c to
829c24d
Compare
d42c82a to
9e745ee
Compare
9e745ee to
d80b5ec
Compare
Collaborator
|
Instead of keep working on this, @philderbeast, do you want to help reviewing this: #8889? |
Collaborator
Author
This has been ready for 3 weeks but I put it in draft while I waited for #10646, needed for asserting on the multiline output. |
f2b83d7 to
c16f967
Compare
5 tasks
5086730 to
1bc9cff
Compare
ffaf1
approved these changes
Jan 16, 2025
Collaborator
ffaf1
left a comment
There was a problem hiding this comment.
Good as far as I can see!
38ce204 to
a406c49
Compare
- Track which file has errors and which has warnings - Add test for import parse warnings - Remove added type sigs, use e for error type - Move ProjectParseResult into its own module - Import qualified from Deprecated.ParseUtils - Reverse warnings so they are in line number order - Report parse result error in imported config - Split project test into warning and error tests - Add type synonyms for project parse - Extract function reportProjectParseWarnings - Show the snippet that doesn't parse - Add if, elif and else test projects - Fix else for elif typo - Show provenance if not root - Rerun expected output with provenance - Redo ParseWarningProvenence with ordered output - Add ProjectParseError record - Reword badly formed comment lines - Satisfy fix-whitespace - Add changelog entry - Updated - indented expectation - No snippet when modifying compiler under condition - Only show custom message with snippet - Rerun expected output with source - Use a Doc for the ReportParseResult message - Update expected .out files - Use normalized path when recursing - Consistent projectParse ... source - Consistent projectParse ... normSource - Use normalizeWindowsOutput - Use .md extension on changelog entry - Satisfy HLint - Revert elif to else, see that this is wrong and undo
71b281b to
8ba44d3
Compare
Collaborator
Author
|
Label merge+no rebase is necessary when the pull request is from an organisation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10635. Improves warning and error messages shown when parsing project files and their imports.
Warning Messages
To trigger these warning messages, the examples use badly formed comments that have a single dash instead of two as is required of a line comment in
.cabaland.projectfiles (and imported.configfiles).Before the fix:
The
cabal.projectfile name is repeated. Warnings are misattributed to having been in the project rather than from a configuration file imported by the project. Warnings are shown in reverse line number order.After the fix:
The warnings are shown in a list. For warnings within the same
.projector imported.configfile, warnings are sorted by line number. The file that is the source of the warning is shown.The warnings associated with configuration files are shown in the order these files were imported by the project:
Error Messages from Project
To trigger these error messages, the examples use badly formed conditions:
Before the fix:
The parse error is shown with hard line breaks.
After the fix:
The snippet that failed to parse may be shown and the parse error is shown as one line, with no hard line breaks.
Error Messages from Imported Config
With the same setup but now with the error in an imported file:
Before the fix:
The project rather than the imported configuration file is shown as the source file.
After the fix:
The imported configuration file is shown as the source with a snippet of the error.
significance: significantin the changelog file.