Claes Jakobsson > Module-Checkstyle-0.04 > Module::Checkstyle::Check::Block

Download:
Module-Checkstyle-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  1
View/Report Bugs
Source  

NAME ^

Module::Checkstyle::Check::Block - Check bracketing etc.

CONFIGURATION DIRECTIVES ^

Default block style

Sets default values for opening-curly, closing-curly and ignore-on-same-line. The following default styles are available:

BSD/Allman (bsd)

Opening and closing curly brackets are placed on lines by themselves.

  if(x == y)
  {
      something();
  }
  else
  {
      somethingelse();
  }

Defaults are opening-curly = alone, closing-curly = alone and ignore-on-same-line = true.

GNU (gnu)

Opening and closing curly brackets are placed on lines by themselves

  if (x == y)
    {
      something ();
    }
  else
    {
      somethingelse ();
    }

Defaults are opening-curly = alone, closing-curly = alone and ignore-on-same-line = true.

K&R (k&r)

Opening curly bracket is placed on the same line as the keyword that defined the block.

  if (x == y) {
       something();
  } else {
      somethingelse();
  }

Defaults are opening-curly = same, closing-curly = same and ignore-on-same-line = true.

Whitesmiths (wts)
 if (x == y)
     {
     something();
     }
 else
     {
     somethingelse();
     }

Defaults are opening-curly = alone, closing-curly = alone and ignore-on-same-line = true.

Perl Best Practices (pbp)
 if (x == y) {
     something();
 }
 else {
     somethingelse();
 }

Defaults are opening-curly = same, closing-curly = alone and ignore-on-same-line = true.

Opening curly position

Controls the position of an opening curly bracket. Set opening-curly to either 'alone' or 'same'.

opening-curly = alone | same

Closing curly position

Controls the position of a closing curly bracket. Set closing-curly to either 'alone' or same'.

closing-curly = alone | same

Ignore curly positions when they appear on the same line

Set ignore-on-same-line to a true value to ignore opening-curly and closing-curly when the curlies appear on the same line. This is useful for expressions such as my @x = map { $_ + 1 } @y;.

ignore-on-same-line = true

SEE ALSO ^

Writing configuration files. "Format" in Module::Checkstyle::Config

Module::Checkstyle

syntax highlighting: