-
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
Deduplicate "using config from" message #10546
Conversation
290bd75
to
8423986
Compare
I think it fixes only part of the duplication problem in the snippet you reference. I.e. it dedups file names but it doesn't dedup the phrase notice verbosity . render . vcat $
text "Configuration is affected by the following files:"
: [ text "-" <+> docProjectConfigPath path
| Explicit path <- Set.toList $ projectConfigProvenance projectConfig
]
|
8423986
to
f6a310b
Compare
I'm already doing dedup of the intro message as a part of #10548 btw. It'd be best if this one only handled the Ord instance. It's also a bit more complicated than I said above: with implicit config provenance, it'll print the intro message and then nothing else, which doesn't make sense. THis is not hard to fix of course. |
f6a310b
to
f28cb93
Compare
@mpickering for these added tests do we already have a normalization of the project root directory for tests, something like $ git diff
...
--- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs
+++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs
@@ -261,6 +261,49 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
log "checking if we detect when the same config is imported via many different paths (we don't)"
woopping <- cabal' "v2-build" [ "--project-file=woops-0.project" ]
+ log "checking \"using config from message\" without URI imports"
+ withDirectory "yops" $ do
+ yopping <- fails $ cabal' "v2-build" [ "--project-file=../yops-0.project" ]
+ assertOutputContains
+ (normalizeWindowsOutput "When using configuration from: \
+ \ - /tmp/cabal-testsuite-286573/yops-0.project \
+ \ - /tmp/cabal-testsuite-286573/yops-2.config \
+ \ - /tmp/cabal-testsuite-286573/yops-4.config \
+ \ - /tmp/cabal-testsuite-286573/yops-6.config \
+ \ - /tmp/cabal-testsuite-286573/yops-8.config \
+ \ - /tmp/cabal-testsuite-286573/yops/yops-1.config \
+ \ - /tmp/cabal-testsuite-286573/yops/yops-3.config \
+ \ - /tmp/cabal-testsuite-286573/yops/yops-5.config \
+ \ - /tmp/cabal-testsuite-286573/yops/yops-7.config \
+ \ - /tmp/cabal-testsuite-286573/yops/yops-9.config \
+ \ The following errors occurred: \
+ \ - The package directory '.' does not contain any .cabal file.")
+ yopping
+
+ return ()
+
+ log "checking \"using config from message\" with URI imports"
+ withDirectory "woops" $ do
+ woopping <- fails $ cabal' "v2-build" [ "--project-file=../woops-0.project" ]
+ assertOutputContains
+ (normalizeWindowsOutput "When using configuration from: \
+ \ - /tmp/cabal-testsuite-282695/woops-0.project \
+ \ - /tmp/cabal-testsuite-282695/woops-2.config \
+ \ - /tmp/cabal-testsuite-282695/woops-4.config \
+ \ - /tmp/cabal-testsuite-282695/woops-6.config \
+ \ - /tmp/cabal-testsuite-282695/woops-8.config \
+ \ - /tmp/cabal-testsuite-282695/woops/woops-1.config \
+ \ - /tmp/cabal-testsuite-282695/woops/woops-3.config \
+ \ - /tmp/cabal-testsuite-282695/woops/woops-5.config \
+ \ - /tmp/cabal-testsuite-282695/woops/woops-7.config \
+ \ - /tmp/cabal-testsuite-282695/woops/woops-9.config \
+ \ - https://www.stackage.org/lts-21.25/cabal.config \
+ \ The following errors occurred: \
+ \ - The package directory '.' does not contain any .cabal file.")
+ woopping
+
+ return () |
The previous person who bumped into this problem wasn't able to find an existing solution: #8617 (comment) |
bf674e3
to
7070d18
Compare
@ulysses4ever and @mpickering, to get around the I see that cabal/cabal-testsuite/src/Test/Cabal/Monad.hs Lines 790 to 791 in 7de199a
|
This will need another review because previously I'd mucked up the |
I didn't add a test of an http import importing another http config file. Two possible ways of doing this are running a local server for the test or picking up the import from somewhere like |
I'm traveling this week, so will only be able to get to this next week at earliest. Sorry! |
@ulysses4ever there are two similar messages. You've dealt with the
|
7070d18
to
88b92e6
Compare
I can dismiss it (click the downarrow to the right of "2 approvals", then the 3-dots to the right of his approval), but I'm not sure if that's an admin action or something you can do. Do you want me to dismiss it? |
Thanks @geekosaur, I can dismiss it. |
This was a review of an earlier version with an incorrect Ord
instance.
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.
This is quite delicate and I guess the devil might be in the details, but the tests are solid and LGTM.
@Mikolaj, I've updated the haddocks on |
06b9d44
to
4ab4537
Compare
Label merge+no rebase is necessary when the pull request is from an organisation. |
cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs
Outdated
Show resolved
Hide resolved
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.
Looks reasonable. I think the release note could use a before/after example to show how this helps users. (I don't care about an Ord
instance but I care a lot about error message quality!)
- Consider URI in Ord instance - Use <> in Ord instance of ProjectConfigPath - Add unconsProjectConfigPath - Add docProjectConfigFiles - Remove docProjectConfigPaths - Clarify sorting haddocks for Ord ProjectConfigPath
8103a64
to
5c9d530
Compare
@9999years I've updated the changelog entry to talk more about the "using configuration from" message changes. @Kleidukos what is the |
f4d9610
to
95b78e2
Compare
@philderbeast that label does not prevent merging, it's for after-merge :) |
(I had also approved it beforehand so as not to block the merge) |
- Add woops test - Regen expected output without duplication - Add "when using config from" tests - Remove unnecessary normalizeWindowsOutput - Change assertion message - Match on (\n|\r\n) for line endings - Note /tmp/cabal-testsuite-*/ not seen on Windows - Always have the project itself sort first - Use with-ghc.config with woops project - Remove docProjectConfigPaths - docProjectConfigFiles is the better name when not reporting "imported by" - Use --dry-run for config listing tests - Only use woops project once in tests - Don't use same project twice in tests - Put dedup test into its own folder - Simplify the project file names - Can be done now that the test is in its own folder - Move using config dedup test to ProjectImport dir - Remove an additional test on yops project - checking "using config from message" without URI imports - Add simple test for changelog - Better explain the message changes - Redo the test so the project doesn't sort 1st - Don't need to specify default project explicitly - Add a z-empty.config lexically sorted last
95b78e2
to
73a13f1
Compare
Adds an
Ord
instance forProjectConfigPath
and fixes the duplication in the reported "Configuration is affected by the following files", fixes #10509 by usingdocProjectConfigFiles
instead ofdocProjectConfigPath
.Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
significance: significant
in the changelog file.