haskell / haskell/cabal

Warn about overly many `source-repository` stanzas

Open
#10,574 2 comments 0 reactions 0 assignees View on GitHub
cabal-install: cmd/check Cabal: parser type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

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`;

```diff
$ 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 https://github.com/haskell/cabal/issues/9655#issuecomment-1907990554_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.