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

Code Actions (quick fixes) for ansible-lint findings #1100

Open
tlourey opened this issue Feb 17, 2024 · 4 comments
Open

Code Actions (quick fixes) for ansible-lint findings #1100

tlourey opened this issue Feb 17, 2024 · 4 comments
Labels
feature New feature or request

Comments

@tlourey
Copy link

tlourey commented Feb 17, 2024

Problem

Ansible-lint findings in problems tab don't provide quick fix code actions

Solution

Support Quick Fix Code Actions in Ansible Extension for VS Code

Alternatives

No response

Additional context

Refer:
https://code.visualstudio.com/Docs/editor/editingevolved#_code-action
https://code.visualstudio.com/docs/editor/refactoring#_code-actions-quick-fixes-and-refactorings

@tlourey tlourey added feature New feature or request new labels Feb 17, 2024
@ssbarnea ssbarnea removed the new label Feb 28, 2024
@ssbarnea
Copy link
Member

@tlourey That seems like a wonderful suggestion but AFAIK we currently do not have anything planned in this direction. Still, if you can come up with PR that adds support for it, you will have all my support for including it in the extension.

@tlourey
Copy link
Author

tlourey commented Mar 3, 2024

Hi @ssbarnea , unfortunately that is far beyond my skill set.

I'm lead to believe the extension developer just need to pass extra information when passing back problems (sounds easy! 😂). Markdownlint might be a good one to look as an example of what I'm suggesting.

I just know using the quick fix button for listed problems when working on PowerShell or Markdown (with the markdown lint extension above) is massive timesaver and help so I thought id suggest it. Might be something for the roadmap!

Edit: I think I just found the page for extension developers: https://code.visualstudio.com/blogs/2016/11/15/formatters-best-practices

@priyamsahoo
Copy link
Contributor

Hi @tlourey, you can use the ansible.validation.lint.arguments setting and add --fix in it. This will automatically fix the lint errors (that support fixing) in your playbook/task files.

@tlourey
Copy link
Author

tlourey commented May 6, 2024

Thanks @priyamsahoo.

@ssbarnea does this seem like something you add into the vscode extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: No status
Development

No branches or pull requests

3 participants