develooper Front page | perl.perl5.porters | Postings from February 2022

I created a PR with a copy of my "clean-commit" tool in it

February 19, 2022 15:42
I created a PR with a copy of my "clean-commit" tool in it
Message ID:
For many years I have used a tool which cleans up whitespace issues in my
commits prior to committing. Today I made some changes to it to make it a
bit more perl core development friendly and pushed it as:



The main advantage of this tool as compared to most other whitespace fixup
tools is that it will only update lines which have been modified in the
commit. So if you modify one line and  it has trailing whitespace you won't
end up modifying  the entire file just the line you changed.

If you add a new file then it will clean the entire file. And  there are
some options to tell it to work on the entire file if you wish.

For "code" files, such as those ending in .pl or .pm or .xs or .c or .h it
will convert tabs to spaces.

For other files it will only trim trailing whitespace on lines, and remove
empty lines from the end of the file should you add any.

It will ignore files that contain our traditional "DO NOT EDIT THIS FILE"

We can add other rules if we wish or make it smarter about how it decided
what files to modify or not.

I could have released this to CPAN as a script but I figured for core perl
devs it would be handy to have it in Porting. For instance we could set up
a test that  checks that running it does not change anything to prevent new
whitespace issues from creeping into the build.

I did not think that a tool like this in Porting required an RFC, if I am
wrong I apologize.


perl -Mre=debug -e "/just|another|perl|hacker/" Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About