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

Support vale --fix and automatically execute actions #939

Open
1 task done
twitchard opened this issue Dec 18, 2024 · 0 comments
Open
1 task done

Support vale --fix and automatically execute actions #939

twitchard opened this issue Dec 18, 2024 · 0 comments

Comments

@twitchard
Copy link

Check for existing issues

  • Completed

Describe the feature

Most popular linters have a --fix flag where they will apply fixes inline for violations, if the rule defines them.

I assumed that this existed for Vale when I was reading the docs about actions, spent a few hours learning Tengo and implementing an action for the custom rule I wanted, and was a little surprised to discover that Vale seems to completely ignore the Tengo code I wrote, all it does is pass through the path to the Tengo script of the script, so that potentially other tools (none of which I use) could run it if they wanted to.

I'm going to adopt the Github Action, so in the long run my needs will be met, but in the meantime there are ~80 violations (too many for the github action to report) that are fixable by the Tengo code I wrote but I have no way to easily apply them.

Feature request: support vale --fix

It would be lovely if vale --fix could automatically apply actions that followed the conventions outlined in the actions doc.

This appears to have been suggested previously in #329. The response there mentions a commercial "Vale Server" but I don't think that exists anymore? It also mentions that sometimes the way to "fix" the result of an action is ambiguous. I still think a vale --fix that worked just in the cases where there is no ambiguity would be valuable. It could also be viable to prompt among alternatives.

Suggestion: clarify the status quo in the docs

The docs state

Actions provide a way for external tools to provide methods for correcting style issues.

The meaning of this is clear to me in retrospect, but I didn't absorb the message the first time I read it.

You could rephrase this as

Actions are a way for your styles to trigger behavior from external tools like the Vale Github Action or the Vale Language Server. The Vale CLI does not execute actions itself, it merely reports what actions should be run alongside each style issue.

There are also some other confusing things about the actions doc: e.g. in once place it refers to "the script action" but (as far as I can tell) there is no standard action named "script", the action is named "suggest" and the action accepts a parameter that by convention is either the word "spellings" or the path to a Tengo script that an external tool would conventionally execute, passing in appropriate values for "text" and reading values from "suggestions".

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

1 participant