input-output-hk / foliage

🌿 Foliage is a tool to create custom Haskell package repositories, in a fully reproducible way.
MIT License
42 stars 9 forks source link

Add format command. #55

Closed andreabedini closed 5 months ago

andreabedini commented 1 year ago

This command reads and re-writes (in-place) the metadata files. When applied to CHaP, the result is

--- a/_sources/vector-map/1.0.1.0/meta.toml
+++ b/_sources/vector-map/1.0.1.0/meta.toml
@@ -1,3 +1,6 @@
-timestamp = 2023-04-05T21:13:03Z
-github = { repo = "input-output-hk/cardano-ledger", rev = "f10f06f6ab96b5ee52a28ccc45b41a592efde4b7" }
-subdir = 'libs/vector-map'
+subdir = "libs/vector-map"
+timestamp = 2023-04-05T21:13:03+00:00
+
+[github]
+  repo = "input-output-hk/cardano-ledger"
+  rev = "f10f06f6ab96b5ee52a28ccc45b41a592efde4b7"

It would be better if CHaP's add-from-github.sh would use the same formatting but it would be even better to put that functionality inside foliage itself.

andreabedini commented 1 year ago

I wouldn't expect a "lint" command to modify my source tree by default. It could have a --fix flag or something that tells it to actually try to fix problems.

Yes, you are right. Also, what this PR introduces is more a format than a lint.

andreabedini commented 5 months ago

I believe this is not the direction we want to go.