Add sed and gsed output formats to auto-fix code #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The sed format outputs sed commands that should fix some of the errors. Note that this requires gnu sed. If that is installed as gsed on your system (common e.g. on macOS with homebrew) you can use the gsed output format.
Sed commands are written to stdout, not stderr, so you should be able to pipe output straight to a shell to run the fixes, e.g.
Currently doesn't apply fixes that cause line numbers below to change. I plan to reverse the order of the output by storing it in the _junit_errors array, then reversing on print, so that line numbers are only changed for lines lower in the file which would have already been fixed.
This was written on a different fork of cpplint that followed different coding standards, and I have attempted to merge only the relevant parts in. I'm submitting this PR to get feedback on whether it is likely to be accepted and if I am doing things in the best way.