-
Notifications
You must be signed in to change notification settings - Fork 132
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
Is it possible to turn off autoformatting? #300
Comments
@joneshf what kind of issue are you having with the autoformatting? From the Slack channel it looks like the problem is that Spago uses a non-default format command. So would it be enough to document that we autoformat with |
Nah, the issue isn't the output of formatting. |
Could you detail the usecase some more? |
We use I'm not looking to turn off formatting for everyone all the time. But for us, it would be great if we could turn it off when we need to. |
@joneshf right, good point. I believe a good solution here could be to check if the file is formatted (with the library equivalent of |
Hmm, I dunno. That might help for that one rule, but it doesn't sound it would fix that one rule. Instead of the rule firing each run, it would fire at most two times each time Taking a step back, it's a bit unexpected that Again, not looking to change the default for everyone. We've already worked around this issue, so it's not a make or break thing. But, it would simplify our build system if we could pass in a flag instead of altering our rules. |
Yeah, makes sense. Let's add a global |
- Add `dontFormatConfig` to `GlobalOptions` - Add condition to `Spago.Dhall.format` with `Bool` parameter
- Add `dontFormatConfig` to `GlobalOptions` - Add condition to `Spago.Dhall.writeRawExpr` with `Bool` parameter
- Add `dontFormatConfig` to `GlobalOptions` - Add condition to `Spago.Dhall.writeRawExpr` with `Bool` parameter
Opened #302 . Please help with review. |
The above PR is merged, should this ticket be closed? |
@LiamGoodacre: upon further investigation I realized that the "autoformatting" is happening because we're trying to migrate old configs without checking if they are using the old schema - this is effectively idempotent except it reformats the file So I think we should get rid of the flag and just write the file if it's effectively needed (that is, Spago doesn't want to reformat your files, but it will need to in some cases, and we cannot have a flag to shut this behaviour of it's needed to proceed) However before doing this I'm waiting on #301, as that's shuffling some very relevant code |
That makes sense, thanks! |
You're welcome 🙂 I'll fix this before the new release (happening any day now) |
Shouldn't it be possible to read an old version without also writing the file out? |
@joneshf yes, this is what will happen after 1.0: we'll either not change the config format or just read the files in old config formats However while we are in "pre-1.0" I'd like to migrate config files to the newest version as much as we can, so we can deprecate old config formats (and the migration logic itself) and have our "breaking config changes" not be distruptive for users I think this is fine because "configuration migration" is a one-off write, so it's not disruptive for build systems etc (the bug here is that we're writing the file every time anyways) If you're curious about all behaviours that will change in 1.0, see #291 (which already contains "stop migrating configs") |
It looks like every time
spago
runs, it reformats the Dhall file. Is there a way to tellspago
not to format the files when it runs?The text was updated successfully, but these errors were encountered: