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

Better Error Message for "Rule not found for" #11208

Open
sabine opened this issue Dec 14, 2024 · 2 comments
Open

Better Error Message for "Rule not found for" #11208

sabine opened this issue Dec 14, 2024 · 2 comments

Comments

@sabine
Copy link

sabine commented Dec 14, 2024

Desired Behavior

Error message should be clearer in that this either means that the file you're depending on does not exist, or that a rule is missing.

Example

Instead of

File "dune", lines 6-9, characters 0-120:
6 | (rule
7 |   (targets [template.ml](https://template.ml/))
8 |   (deps [template.eml.ml](https://template.eml.ml/))
9 |   (action (run dream_eml %{deps} --workspace %{workspace_root})))
Error: No rule found for [template.eml.ml](https://template.eml.ml/)

dune could report

File "dune", lines 6-9, characters 0-120:
6 | (rule
7 |   (targets [template.ml](https://template.ml/))
8 |   (deps [template.eml.ml](https://template.eml.ml/))
9 |   (action (run dream_eml %{deps} --workspace %{workspace_root})))
Error: Dependency template.eml.ml not found.

You either need to
* add a rule to generate it, or
* provide the file in the correct location ([path where dune is looking for the file]).
@sabine
Copy link
Author

sabine commented Dec 14, 2024

Similarly, when there's a dependency referencing a folder without a dune file in it, it would be good if the error message would reflect that the lack of a dune file is a probably cause for the failure, I guess?

@maiste
Copy link
Collaborator

maiste commented Dec 16, 2024

For the first message, we could provide a hint. I don't know how much precise we could be when generating the hint.

Similarly, when there's a dependency referencing a folder without a dune file in it, it would be good if the error message would reflect that the lack of a dune file is a probably cause for the failure, I guess?

If you use (include_subdirs qualified) you can have subfolders without dune file in it. I'm not sure if it would be possible to detect this under these conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants