You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 18, 2018. It is now read-only.
It would be great if ocamlint could be ran in a way that produced a unified diff, instead of a warning. Linting, in my opinion, is so useful because it is, by definition, things that don't require much thought eg trailing whitespace, an the things ocamllint is currently doing. If ocamlint could return a diff, then it can be used interactively which tools such as arcanist to either autocorrect problems, or interactively ask the user if they want the corrections.
I didn't look into the implementation, so I do not know how feasible this is. I did notice that you state the rules work on the abstract syntax tree. Is the original syntax still around?
Curious to hear your thoughts on the usefulness of this idea, as well as the difficulty in implementing.
Thanks!
The text was updated successfully, but these errors were encountered:
I agree that such a feature would be great. Hlint got something similar quite recently and I think it's improved the tool a lot.
I'm afraid that ppx modules are a bit too far in the chain, acting on the AST. Most of the elements have a location attached, which makes it possible to know some information, but not everything. For example you can't see tokens like begin/end at all (and they are parsed in the same way as (/).
It is possible to pretty-print an AST using functions like Pprintast.string_of_expression but it will just display the code without honoring the locations. ocp_indent does this job to fix the indentation, but I think it has its own parser. I think that merlin would be able to do this too, so we'd have to see if some interop is possible.
One first step in this direction (that would be required anyway to have a diff mode) is to start by adding a "suggestion" part to each rule, as it is not done at the moment.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It would be great if ocamlint could be ran in a way that produced a unified diff, instead of a warning. Linting, in my opinion, is so useful because it is, by definition, things that don't require much thought eg trailing whitespace, an the things ocamllint is currently doing. If ocamlint could return a diff, then it can be used interactively which tools such as arcanist to either autocorrect problems, or interactively ask the user if they want the corrections.
I didn't look into the implementation, so I do not know how feasible this is. I did notice that you state the rules work on the abstract syntax tree. Is the original syntax still around?
Curious to hear your thoughts on the usefulness of this idea, as well as the difficulty in implementing.
Thanks!
The text was updated successfully, but these errors were encountered: