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

[Feature] Auto Fix #1220

Closed
Dmole opened this issue May 13, 2018 · 5 comments

Comments

@Dmole
Copy link

commented May 13, 2018

I searched issues for "auto fix" and didn't find anything related.
Is there any interest in an auto fix feature?

When first discovering shellcheck, and when inheriting code, and when upgrading to a new version of shellcheck there can be an overwhelming number of simple fixes that can be solved by find . -iname '*.sh' | xargs -I {} perl -pi -e "$RE" {} followed by git diff-highlight review of course. So instead of everyone independently creating $RE we could have an "auto fix" feature that would make a best effort to correct common issues.

Am I the outlier here or is anyone else accumulating a list of Regular Expressions to help fix issues identified by shellcheck?

@Dmole Dmole changed the title Auto Fix [Feature] Auto Fix May 13, 2018

@matthewpersico

This comment has been minimized.

Copy link

commented May 14, 2018

At this point, I'd say the next step is a proof-of-concept called shellfix. If it seems viable (meaning there are enough REs to make it worth the effort), then maybe a --fix option, plus functionality, could be grafted into shellcheck.

So, the original question still begs - is anyone out there doing autocorrect?

@maweki

This comment has been minimized.

Copy link

commented May 15, 2018

I would like that feature very much but I would also be fine with having a patch-file for the fix as alternate output. Then I could apply the patches easily enough.

@koalaman

This comment has been minimized.

Copy link
Owner

commented May 27, 2018

This was the intention behind #695 from a few years ago, but it's hard to retrofit this kind of functionality.

@maweki

This comment has been minimized.

Copy link

commented May 27, 2018

But the corrected line is suggested. So in theory, having an applyable diff as output would be fine as well and doable.

colindean added a commit to colindean/hejmo that referenced this issue Aug 16, 2018
Runs shellcheck and Rubocop on everything
Manually fixed because autofix doesn't exist yet.

koalaman/shellcheck#1220

@koalaman koalaman added the autofix label Dec 18, 2018

@koalaman

This comment has been minimized.

Copy link
Owner

commented Jun 24, 2019

There's now diff output in b1aeee5!

@koalaman koalaman closed this Jun 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.