-
Notifications
You must be signed in to change notification settings - Fork 696
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
Add source file to project parse errors and warnings #10644
base: master
Are you sure you want to change the base?
Add source file to project parse errors and warnings #10644
Conversation
7c990c9
to
a74ddc3
Compare
@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
|
<$> adaptParseError l (parseConditionConfVarFromClause . BS.pack $ "else(" <> p <> ")") | ||
<$> ( let s = "elif(" <> p <> ")" | ||
in projectParse (Just s) source (adaptParseError l (parseConditionConfVarFromClause $ BS.pack s)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gbaz was this a typo, using "else(" instead of "elif("?
deec1f5
to
6f5239b
Compare
6f5239b
to
9f05ce2
Compare
Reverting to draft while I settle some Windows versus POSIX file path issues. |
3981374
to
d45311c
Compare
- Track which file has errors and which has warnings
- Manually replace path separators before anything else
d45311c
to
829c24d
Compare
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
.cabal
and.project
files (and imported.config
files).Before the fix:
The
cabal.project
file 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
.project
or imported.config
file, 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: significant
in the changelog file.