-
Notifications
You must be signed in to change notification settings - Fork 412
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-dune-file)
action
#11166
Conversation
src/dune_rules/stanzas/rule_conf.ml
Outdated
@@ -62,6 +62,7 @@ let atom_table = | |||
; "aliases", Field | |||
; "alias", Field | |||
; "enabled_if", Field | |||
; "format-dune-file", Field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be this?
; "format-dune-file", Field | |
; "format-dune-file", Since ((3,18), Field) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a format action defined in Format_rules
. You can just use that instead of extending the engine.
Thanks, I had missed this. This is now done: a7abf53. For simplicity, the action now has the form |
@@ -188,3 +188,47 @@ Non 0 error code: | |||
File "", line 2, characters 0-0: | |||
Error: unclosed parenthesis at end of input | |||
1 | |||
|
|||
Using the built-in action. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a test demonstraating how the action fails when given an invalid dune file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks.
Would be appreciated if the update to dune lang 3.18 was done in a separate PR |
Good idea, done in #11175 |
a7abf53
to
6978294
Compare
Thanks for the review @rgrinberg. I think all issues have been addressed. |
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
73fb0b2
to
9317471
Compare
Planning to merge soon if the CI passes. Yell if you object! |
Context is #10892 (comment).
This exposes a user action
(format-dune-file file)
which outputs the formatted contents offile
(assumed to contain S-expressions) to standard output. It uses the version for the formatting specified by the current project.This action should be used instead of calling
dune format-dune-file
from inside a user rule, which does not work well (calling Dune recursively is not really well supported).cc @maiste @Leonidas-from-XIV