Create cabal-fmt, a style enforcer for .cabal and .config files
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
This idea is a bit more "out there".
We'd like to do some automatic rewriting of user edited files, namely `cabal.config`, in order to support `install --freeze-dependencies`. Briefly, that command would edit the `constraints` section of the `cabal.config` file.
Since the user also edits `cabal.config` we have the problem of automatically editing the file without introducing spurious changes e.g. whitespace-changes or section ordering changes.
The Go programming language tackles this problem in the area of source code by simply requiring all source code to be formatted the same way, using the go-fmt tool to enforce this. This makes automatic rewriting much easier, as you can do the rewriting in any which way and run the result through go-fmt.
The idea would be to decide on a style for .cabal and .config files and have a tool that can be used to enforce it. I hope such a style shouldn't be too controversial as there's very little meaningful formatting to be done in these two file types.
Once we have this tool cabal itself can use it in both `install --freeze-dependencies` and `init` and e.g. emacs-mode could use it as a on-save hook for .cabal files.
Contributor guide
Assessment
This issue has not been assessed yet.