Skip to content

Add a tool which can clean up whitespace in a commit intelligently #19441

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

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

demerphq
Copy link
Collaborator

@demerphq demerphq commented Feb 19, 2022

Add a tool which can clean up whitespace in a commit intelligently based on git-blame.

Will ONLY modify lines that were changed unless asked to do the whole file.

Will not change files marked with "DO NOT EDIT THIS FILE".

Will convert tabs to spaces in files ending in .pl, .pm, .xs, .c, .h

Will remove trailing whitespace from lines.

Will remove blank lines at EOF.

@demerphq demerphq force-pushed the yves/clean-commit branch 2 times, most recently from 7c08c61 to c0ee548 Compare February 19, 2022 14:28
Will ONLY modify lines that were changed unless asked to do the whole file.

Will ignore files containing "DO NOT EDIT THIS FILE".

Will convert tabs to spaces in files ending in .pl, .pm, .xs, .c, .h

Will remove trailing whitespace from lines in all file types.

Will remove blank lines at EOF in all file types.

use constant {
NULL_SHA1 => ("0" x 40),
TAB => " " x 8,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most of the Perl code I've seen in the core distribution, 4 spaces is the equivalent of a tab. I would say that it's about 75% 4-spaces, 23% 2-spaces, balance other. So I think setting TAB to 8 is not consistent with our practice. (I'm not claiming we're very consistent about this.) I realize that in pod/perlpod.pod there is a section on "Verbatim Paragraph" that calls for 8-space tabs, but don't see any indication that that applies more generally.

Perhaps we could make this configurable with a command-line switch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most of the Perl code I've seen in the core distribution, 4 spaces is the equivalent of a tab.

No it not. The indent was 4 spaces, but a tab was always 8.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most of the Perl code I've seen in the core distribution, 4 spaces is the equivalent of a tab.

No it not. The indent was 4 spaces, but a tab was always 8.

I'm not going to get dogmatic about 8-space tab, but can you point us to where that's documented?

@jkeenan
Copy link
Contributor

jkeenan commented Aug 7, 2022

Add a tool which can clean up whitespace in a commit intelligently based on git-blame.

@demerphq, can you point to a commit where you used this program to clean up messy whitespace in the course of the commit?

@demerphq
Copy link
Collaborator Author

demerphq commented Aug 8, 2022 via email

@demerphq
Copy link
Collaborator Author

demerphq commented Aug 8, 2022 via email

@demerphq
Copy link
Collaborator Author

demerphq commented Aug 8, 2022 via email

@jkeenan jkeenan added the Infrastructure Things needed to maintain Perl development label Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hasConflicts Infrastructure Things needed to maintain Perl development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants