Skip to content
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

Warn about overly many source-repository stanzas #10574

Open
philderbeast opened this issue Nov 21, 2024 · 2 comments
Open

Warn about overly many source-repository stanzas #10574

philderbeast opened this issue Nov 21, 2024 · 2 comments

Comments

@philderbeast
Copy link
Collaborator

philderbeast commented Nov 21, 2024

Can we have cabal check warn if there is more than one source-repository head or more than one source-repository this stanza?

I ran a quick cabal check and we can have as many source-repository stanza as we please. The following passes cabal check;

$ git diff
diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal
index f842d4d31..afc1101b9 100644
--- a/cabal-install/cabal-install.cabal
+++ b/cabal-install/cabal-install.cabal
@@ -26,6 +26,23 @@ source-repository head
   location: https://github.com/haskell/cabal/
   subdir:   cabal-install
 
+source-repository head
+  type:     git
+  location: https://gitlab.com/haskell/cabal/
+  subdir:   cabal-install
+
+source-repository this
+  type:     git
+  location: https://github.com/haskell/cabal/
+  tag:      v3.11.0.0
+  subdir:   cabal-install
+
+source-repository this
+  type:     git
+  location: https://gitlab.com/haskell/cabal/
+  tag:      v3.11.0.0
+  subdir:   cabal-install

Originally posted by @philderbeast in #9655 (comment)

@ffaf1
Copy link
Collaborator

ffaf1 commented Nov 21, 2024

Interestingly enough, PackageDescription allows more SourceRepos:

I wonder whether there is a legitimate use-case for multiple repos.

@ulysses4ever
Copy link
Collaborator

It's pretty clear to me that at least two should be allowed, as long one is head and one is this (not that I think it's a great idea to have both). If we could emit a soft warning on the repetitive head or this, that would be an (admittedly slight) improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants