Ivan Bessarabov edited this page Dec 26, 2013 · 8 revisions

Who uses Test::Whitespaces

Feel free to add your projects to this list =)

Thought about interface

On this page I have written some of my ideas of how the interface of the libracy can be changed.

This is only ideas and for now I'm not sure that it will be implemeted.

So. I want to add customization to this module.

This module consists of three parts:

  • script test_whitespaces that can be used to check files for whitespaces errors
  • script whiter that fixes the whitespaces problems
  • library Test::Whitespaces that can be used in Perl tests to make sure your source code has no problmes with whitespaces.

For now this kinds of whitespaces errors are checked and fixed:

  • no tabs are used
  • in fixing script tabs are replaced by 4 spaces
  • no spaces at the end of lines
  • unix style line break. Only "\n", but not windows style "\r\n"
  • each line ends with "\n" (including the last line)
  • no blank lines in the end of file

I want to make some of this parameters customizable. In the future all that thing need to have the ability to customize, but in the neares release only some of them will be customizable.

The main idea of the Test::Whitespaces is simplisity in understanding. Reading the code should give you the exact idea of what this code is doing. One should not read the documentation to understand the code and idealy one should not read the POD to understand how to make a small fix in script.

So, now I'm thinkg about this syntax for Test::Whitespaces. In xt/whitespaces.t:

use Test::Whitespaces [

        settings => {

        # Directories to check all the files from
        dirs => [ 'lib', 'bin', 't' ],

        # Files to be checekd (if you don't need to check the whole dir)
        files => [ 'README' ],

        # Files that matches any of this regexp will not be checked
        ignore => [ qr{\.bak$} ],
        settings => {
            tabs_allowed => $true,
            eol_style => 'unix',    # 'dos' is the other possible way
        files => [ 'Makefile' ],
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.