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

fix(lint-fmt): do not fail on generated files #909

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

edwintorok
Copy link
Contributor

In 1 lint-fmt failed because of missing dependencies:

File "bin/dune", line 6, characters 43-49:
6 |  (libraries dune-site.plugins cmdliner fmt gospel registration))
                                               ^^^^^^
Error: Library "gospel" not found.
-> required by _build/default/bin/cli.exe
-> required by _build/install/default/bin/ortac
-> required by _build/default/examples/lwt_dllist_tests.ml
-> required by alias examples/.formatted/fmt
-> required by alias examples/fmt

Dune was trying to build the generated file, however that is not really necessary (there is one in the build tree already), so we should instead ask dune to ignore promoted rules when formatting.

I tested the command dune build @fmt --ignore-promoted-rules manually (after removing the gospel library) in the ortac repository and it succeeded.

Copy link
Contributor

@benmandrew benmandrew left a comment

Choose a reason for hiding this comment

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

Thank you!

@benmandrew
Copy link
Contributor

@edwintorok could you run dune fmt? I will then merge.

In [1] `lint-fmt` failed because of missing dependencies:
```
File "bin/dune", line 6, characters 43-49:
6 |  (libraries dune-site.plugins cmdliner fmt gospel registration))
                                               ^^^^^^
Error: Library "gospel" not found.
-> required by _build/default/bin/cli.exe
-> required by _build/install/default/bin/ortac
-> required by _build/default/examples/lwt_dllist_tests.ml
-> required by alias examples/.formatted/fmt
-> required by alias examples/fmt
```

Dune was trying to build the generated file, however that is not really
necessary (there is one in the build tree already), so we should instead
ask dune to ignore promoted rules when formatting.

I tested the command `dune build @fmt --ignore-promoted-rules` manually
(after removing the `gospel` library) in the `ortac` repository and it succeeded.

[1]: https://ocaml.ci.dev/github/ocaml-gospel/ortac/commit/f5c535da2cdc43f24de078ec0540267210b79905/variant/%28lint-fmt%29

Signed-off-by: Edwin Török <edwin@etorok.net>
@benmandrew benmandrew merged commit 385f765 into ocurrent:master Dec 11, 2023
2 checks passed
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.

2 participants