Open lafrenierejm opened 4 years ago
Wait, I use ShellCheck all the time, and thought it was only a linter. And its README even says:
ShellCheck does not attempt to enforce any kind of formatting or indenting style, so also check out shfmt!
What am I missing? :-)
Wait, I use ShellCheck all the time, and thought it was only a linter. And its README even says:
ShellCheck does not attempt to enforce any kind of formatting or indenting style, so also check out shfmt!
What am I missing? :-)
It is true that its authors don't intend for ShellCheck to be used as a formatter. For some of the problems it can detect, though, ShellCheck is capable of recommending fixes. And one of the output formats ShellCheck supports is diff. That output would be sufficient to be consumed in an automated way, I I find that I typically do want to apply most or all of the fixes ShellCheck is able to recommend, and I I really like the ergonomics of defining formatters using this reformatter
, so my first instinct was to check reformatter
to see if it supported using diffs.
The feature could feasibly be useful beyond just ShellCheck, so I thought to start a conversation about including it. :) I've started working on a branch to add the feature; if you would rather hold off judgement on the value of the feature until you can demo, I'd be glad to let you know once I have an MVP.
The feature could feasibly be useful beyond just ShellCheck, so I thought to start a conversation about including it. :)
It's definitely something I'd consider.
@purcell I wasn't able to figure out how to get Emacs to apply a patch in an entirely automated fashion. All of my attempts resulted in Emacs starting an interactive diff session. Do you have suggestions for how to avoid that?
There's code floating around for programatically applying RCS-style diffs to the current buffer. That's ultimately what's needed, and ideally not just for RCS-style diffs.
ie. the whole point is to walk the diff and then make very minimal edits in the buffer according to what the diff says.
py-isort, py-autopep8 apply RCS patches too. Would be nice if this package could support it so I don't have to install dozens of packages to format code.
ShellCheck is an example of a tool that doesn't support writing changes in-place, but does support
diff
-style output. Example of runningshellcheck --format=diff
against edx/devstack/course-generator/create-courses.sh: