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

Add format command. #55

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Add format command. #55

wants to merge 2 commits into from

Conversation

andreabedini
Copy link
Member

@andreabedini andreabedini commented Apr 26, 2023

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.

This command reads and re-writes (in-place) the metadata files.
Copy link
Collaborator

@michaelpj michaelpj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

app/Foliage/CmdLint.hs Outdated Show resolved Hide resolved
want ["lintAction"]
where
cacheDir = "_cache"
opts = shakeOptions {shakeFiles = cacheDir, shakeVerbosity = Verbose}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we share this stuff? Seems like the shake options should pretty much always be the same?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should. Also we should wire the verbosity to a command line flag. Also I don't like how shake prints messages.

@andreabedini
Copy link
Member Author

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 andreabedini marked this pull request as draft April 27, 2023 03:29
@andreabedini andreabedini changed the title Add lint command. Add format command. Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants