-
Notifications
You must be signed in to change notification settings - Fork 179
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 location of invalid docstring in warning messages #1529
Conversation
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.
I wonder if this can break the workflow of some people ? For example, when enabling parse-docstrings
on a project that contains a lot of comments that don't parse, every comments will now have to be fixed at the same time.
I suspect this breaks parse-wyc, we should keep the warning in this case.
3f10742
to
2caa764
Compare
I reverted some of these changes, so ocamlformat still doesn't fail on invalid docstrings, all the warnings are printed during the parsing phase instead of in the middle of Fmt_ast, and missing locations are added. |
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.
The cost is to parse each docstrings twice. It's not a huge cost but what are the advantages ?
Showing the location is nice. (grepping for comments is not the best UI)
True, it made more sense when we would fail on invalid docstrings at the beginning, well I find it slightly better to group the checks when parsing the file. We could memoize the parsed docstrings if the cost is too visible to users |
I moved the checks back where they were to reduce the diff. |
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.
Looks good.
Now the invalid docstrings are not reported as warnings anymore but make ocamlformat exit with code 1. I made it the default behavior but we can also choose to hide it behind a new option.(outdated)