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

Remove closing php tags in php class files in addition to all trailing whitespace. #258

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mreiden
Copy link
Contributor

@mreiden mreiden commented Jun 13, 2019

Remove trailing whitespace in txt, xml, and php files. Remove closing php tags in php class files.

@mreiden
Copy link
Contributor Author

mreiden commented Jun 14, 2019

The whitespace changes were done with these commands on RHEL7 (sed's -c preserves file permissions and ownership).

export LC_CTYPE=C
export LANG=C

# Remove trailing whitespace
find . -not \( -name .svn -prune -o -name .git -prune \) \( -iname "*.php" -o -iname "*.txt" -o -iname "*.xml" \) -type f -print0 | xargs -0 sed -c -i -E "s/[[:space:]]*$//"

# Combine multiple trailing newlines at EOF
find . -not \( -name .svn -prune -o -name .git -prune \) \( -iname "*.php" -o -iname "*.txt" -o -iname "*.xml" \) -type f -print0 | xargs -0 sed -c -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba'

# Add a trailing newline if there is not one
find . -not \( -name .svn -prune -o -name .git -prune \) \( -iname "*.php" -o -iname "*.txt" -o -iname "*.xml" \) -type f -print0 | xargs -0 sed -c -i -e '$a\'

The php ending tags were removed after that manually (which explains why a few files were missed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant