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

dune-project not formatted with @fmt #3223

Open
bbc2 opened this issue Feb 29, 2020 · 5 comments · May be fixed by #10716
Open

dune-project not formatted with @fmt #3223

bbc2 opened this issue Feb 29, 2020 · 5 comments · May be fixed by #10716

Comments

@bbc2
Copy link

bbc2 commented Feb 29, 2020

When I run dune build @fmt, I would expect dune-project to be checked as well as other dune files. Any reason for it not to be checked? I understand that the first line of that file (e.g. (lang dune 2.3)) is a bit of an exception, but the rest could probably benefit from auto formatting, no?

Specifications

  • Version of dune (output of dune --version): 2.3.1
  • Version of ocaml (output of ocamlc --version): 4.09.0
  • Operating system (distribution and version): Arch Linux
@ghost
Copy link

ghost commented Mar 2, 2020

Indeed. Reading the code in src/dune/format_rules.ml, it just seems like an omission. More precisely, we recognise dune files but not dune-project files (in the match Path.Source.basename file with | "dune" ...).

/cc @emillon

@ghost
Copy link

ghost commented Mar 2, 2020

Do you want to submit a PR?

@emillon
Copy link
Collaborator

emillon commented Mar 2, 2020

That's in part intentional, because it does not look to great at the moment (#2291). As explained in that bug, the generic s-expression formatter does not know about any syntax (stanza, records, etc).

For dune files it's difficult to have that without adding introspection capabilities to the language (there's no explicit AST), but for dune-project we might be able to do better.

@ghost
Copy link

ghost commented Mar 2, 2020

That makes sense. Since we have a good idea how to add introspection to the language, we should wait for that so that we have a general mechanism.

@jberdine
Copy link
Contributor

jberdine commented Jul 1, 2020

It would make sense to treat dune-workspace files at the same time once the formatting of dune-project files is pretty enough to enable.

@maxRN maxRN linked a pull request Jul 10, 2024 that will close this issue
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 a pull request may close this issue.

3 participants