Skip to content

kentnl/Dist-Zilla-Plugin-Munge-Whitespace

Repository files navigation

NAME

Dist::Zilla::Plugin::Munge::Whitespace - Strip superfluous spaces from pesky files.

VERSION

version 0.001002

DESCRIPTION

This plugin can be used with Dist::Zilla to remove remove white-space from selected files.

In its default mode of operation, it will strip trailing white-space from the selected files in the following forms:

  • 0x20: The literal space character
  • 0x9: The literal tab character, otherwise known as \t
  • 0xD: The Carriage Return character, otherwise known as \r ( But only immediately before a \n )

USAGE

[Munge::Whitespace]
filename = LICENSE  ; *Cough*: https://github.com/Perl-Toolchain-Gang/Software-License/pull/30
filename = Changes
match    = lib/*.pm

; Power User Options
;          Note: turning both of these options on at present would be idiotic.
;          unless you like applying substituion regex to whole files just to duplicate a string
preserve_trailing = 1 ; Don't nom trailing \s and \t
preserve_cr       = 1 ; Don't turn \r\n into \n

Note: This is just a standard munger, and will munge any files it gets told to munge.

It will not however write files out anywhere or make your source tree all pretty.

It will however scrub the files you have on their way out to your dist, or on their way out to any other plugins you might have, like CopyFromRelease or CopyFromBuild, and a smart player can probably combine parts of this with either of those and have their dist automatically cleaned up for them when they run dzil build.

They might also enjoy the luxurious benefits of having sensitive white-space accidentally sent to a magical wonderland, which breaks their code, or have a glorious race condition where something important they were working on and hadn't gotten committed to git yet get eaten due to the file on disk getting updated, and their editor dutifully rejoicing and prompting to reload their file, which may make them respond to the pavlovian conditioning to click "OK", followed by much wailing and gnashing of teeth.

Please enjoy our quality product, from the team at FootGuns Inc.

TODO

  • finder support.

    I figured I could, but YKW,FI.

  • tests

    Would be useful. But dogfood for now.

  • indentation normalization

    Sounds like work.

AUTHOR

Kent Fredric kentnl@cpan.org

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Kent Fredric kentfredric@gmail.com.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

About

Strip superfluous spaces from pesky files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages