The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Test::Whitespaces - test source code for errors in whitespaces

VERSION

Version 0.01

SYNOPSIS

In xt/whitespaces.t:

    use Test::Whitespaces;

Running this test will check all files with the source code in the directories bin, lib, t and xt for errors in whitespaces. It will pretty print all the errors, so it is easy to fix them (by the way, this module ships with a script `whiter` that can automaticly fix all the errors).

You can also customize the test. All parameters are optional.

    use Test::Whitespaces {
        dirs => [ 'script', 'lib' ], # Directories to check all the files from
        files => [ 'README' ],       # Additional files to check
        ignore => [ qr{\.bak$} ],    # Array with regexpex. Files that matches
                                     # that regexp are not checked
    };

DESCRIPTION

This module is intend to solve one simple task: to make sure that your source code don't have problems with whitespaces.

This module checks that all the rules are followed.

  • Each line ends with "\n" (including the last line)

  • For new lines "\n" is used (not "\r\n")

  • There are no ending spaces on the lines

  • 4 spaces are used instead of tabs

  • No empty lines in the end of file

This module don't export any subroutines, you only need to write a test file and write there:

    use Test::Whitespaces;

More complex usage can be found in SYNOPSIS section.

This module does not check the files that are stored in the version control system directories (you remember, that .git, .svn and friends).

This module is shiped with 2 scripts. `test_whitespaces` to easy check files and directories and `whiter` to fix all that errors.

And by the way, this module don't have any dependencies, but Perl. It does not matter much, but it is nice =)

AUTHOR

Ivan Bessarabov, <ivan@bessarabov.ru>

SOURCE CODE

The source code for this module and scripts is hosted on GitHub https://github.com/bessarabov/Test-Whitespaces

BUGS

Please report any bugs or feature requests in GitHub Issues https://github.com/bessarabov/Test-Whitespaces/issues

LICENSE AND COPYRIGHT

Copyright 2013 Ivan Bessarabov.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.