haskell / haskell/cabal

Warn or error on project explicitly importing .freeze or .local

Open
#11,898 1 comment 0 reactions 1 assignee Claimed by @philderbeast View on GitHub
attention: pr-welcome type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the feature request**
Warn or error when a `cabal.project` explicit imports a `cabal.project.freeze` or `cabal.project.local` file. These files are effectively imported implicitly, aren't they?

Doing some adhoc testing for #11884, I see that these files are not filtered already when explicitly imported:

```diff
$ diff --git a/cabal.project b/cabal.project
index a2075cfdc..e1f7cd19a 100644
--- a/cabal.project
+++ b/cabal.project
@@ -12,3 +12,6 @@ package cabal-install

package Cabal
flags: +git-rev
+
+import: cabal.project.freeze
+import: cabal.project.local
```

The adhoc logging output:

```
$ cabal run cabal-install -- build all --dry-run --verbose=3
...
[ProjectMonitoring] Explicit Import of Implicit Files (.local|.freeze):
cabal.project.freeze
cabal.project.local
```

After looking at #6041, I see we might also have to warn about `cabal.project.local` importing `cabal.project.freeze` too (and vice-versa?).

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.