-
Notifications
You must be signed in to change notification settings - Fork 697
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
Improve "Cannot read .cabal file inside ..." errors #10647
base: master
Are you sure you want to change the base?
Conversation
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.
Can we have (a) a PR template and (b) a changelog entry, since this is user visible? Otherwise, nice.
This error message was very confusing -- it doesn't tell you what `.cabal` file it's looking for or why it cannot read the `.cabal` file. (Did it fail to parse the `.tar` archive itself? Did parsing the `.cabal` file fail? If so, why?) This patch improves the error message to include the name of the `.cabal` file being searched for. Additionally, parse errors and warnings are printed, as are format failures in the tarball itself. I ran into this error while I was writing tests for Cabal and it confused the hell out of me; this is an expanded version of the changes I made to help debug that failure.
e7e04d9
to
35917bf
Compare
@@ -1615,7 +1616,7 @@ readSourcePackageCabalFile verbosity pkgfilename content = | |||
case runParseResult (parseGenericPackageDescription content) of | |||
(warnings, Right pkg) -> do | |||
unless (null warnings) $ | |||
info verbosity (formatWarnings warnings) | |||
warn verbosity (formatWarnings warnings) |
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.
Does anyone know why this wasn't warn
already?
assertFailure $ "unexpected: " ++ needle | ||
where output = resultOutput result | ||
|
||
assertOutputMatches :: MonadIO m => WithCallStack (String -> Result -> m ()) |
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.
Added a couple test helpers.
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.
Nice!
This error message was very confusing -- it doesn't tell you what
.cabal
file it's looking for or why it cannot read the.cabal
file. (Did it fail to parse the.tar
archive itself? Did parsing the.cabal
file fail? If so, why?)This patch improves the error message to include the name of the
.cabal
file being searched for. Additionally, parse errors and warnings are printed, as are format failures in the tarball itself.I ran into this error while I was writing tests for Cabal and it confused the hell out of me; this is an expanded version of the changes I made to help debug that failure.
changelog.d/pr-YOUR_PR_NUMBER
base
and third-party library imports use qualified imports or explicit import lists