Skip to content

Instantly share code, notes, and snippets.

@rbreaves
Last active April 14, 2018 17:55
Show Gist options
  • Save rbreaves/ff2d93602e0758c8f9297786855477b8 to your computer and use it in GitHub Desktop.
Save rbreaves/ff2d93602e0758c8f9297786855477b8 to your computer and use it in GitHub Desktop.
Fix improper Coldfusion Code Conventions with Perl
#!/bin/sh
# Run script in the root directory of the site
#Fix tag based functions that have eol and tabs in the tag
find . -name '*.cf*' -not -name '*.json' | xargs perl -i -0pe 's/(?:\G|\<cf)(?:(?!\>).)*\K\n\t+/ /g'
#Fix script based functions that also have eol and tabs
find . -name '*.cf*' -not -name '*.json' | xargs perl -i -0pe 's/(?:\G(?!\A)|\tpublic|\tremote|\tprivate)(?:(?!\)).)*?\K\n\t+/ /g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment