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

Improve dune runtest hints for non-test files #11108

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Alizter
Copy link
Collaborator

@Alizter Alizter commented Nov 10, 2024

Issue

When running dune runtest on a file that is not a test, dune hints

Hint: did you mean <file>

even though the user just gave <file>.

Fix

This stems from a deeper issue with User_message.did_you_mean which accepts hints that are identical to the original name. It doesn't make sense to give a "did you mean" hint in the case they are identical, so we check that the Levenshtein distance is greater than 0.

This removes the useless "did you mean" as observed in the tests.

We will improve the error message in a follow up PR.

Copy link
Collaborator

@Leonidas-from-XIV Leonidas-from-XIV left a comment

Choose a reason for hiding this comment

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

I think this is a solid improvement. It would be nice to see a test changing that shows that it doesn't recommend the same thing as was inserted but I am reasonably certain that filtering out distance 0 does the right thing.

@Alizter
Copy link
Collaborator Author

Alizter commented Nov 14, 2024

@Leonidas-from-XIV There are two commits here. One where the test is added and another where the fix is done, showing how the test changes.

@Leonidas-from-XIV
Copy link
Collaborator

@Alizter Ah, sorry, I somehow that this test was added in this PR. Thanks for the PR; LGTM.

When running dune runtest on a file that is not a test, dune hints

```
Hint: did you mean <file>
```
even though the user just gave `<file>`.

Signed-off-by: Ali Caglayan <[email protected]>

<!-- ps-id: 8dd89353-d656-4214-89eb-0c692c4b5821 -->
When giving "Did you mean" hints, if our candidate list contains what
the user wrote then this hint will not be helpful.

This fixes a useless hint that was being given by dune runtest on
non-test files.

Signed-off-by: Ali Caglayan <[email protected]>

<!-- ps-id: c8d6099c-e98b-4e7f-a3a5-24d1dee04584 -->
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.

3 participants