Perl-Lint

 view release on metacpan or  search on metacpan

t/Policy/NamingConventions/capitalization.t  view on Meta::CPAN

}

===
--- dscr: Localized variable in another package as C-style for loop variable vs the "foo.*bar" capitalization scheme.
--- failures: 0
--- params: {capitalization => {global_variables => 'foo.*bar'}}
--- input
for (local $Foo::Baz = -23; $Foo::Baz <= 17; $Foo::Baz += 3) {
    say $Foo::Baz
}

===
--- dscr: Local lexical variable, in I/O assignment in while loop, named "xyzzy" vs the "foo.*bar" capitalization scheme.
--- failures: 1
--- params: {capitalization => {subroutines => ':all_lower', local_lexical_variables => 'foo.*bar'}}
--- input
sub some_subroutine {
    while (my $xyzzy = <>) {
        say $xyzzy;
    }
}

===
--- dscr: Label named "xyzzy" vs the "foo.*bar" capitalization scheme.
--- failures: 1
--- params: {capitalization => {labels => 'foo.*bar'}}
--- input
xyzzy:
while ( foo() ) {
    next xyzzy;
}

===
--- dscr: Exempted label named "bLaHlAhLaH" vs the "foo.*bar" capitalization scheme.
--- failures: 0
--- params: {capitalization => {labels => 'foo.*bar', label_exemptions => 'bLa.*LaH'}}
--- input
bLaHlAhLaH:
while ( foo() ) {
    next bLaHlAhLaH;
}
# NOTE need it?
# ===
# --- dscr: Variable in continue block gets handled as a local lexical and not a scoped lexical.
# --- failures: 1
# --- params: {capitalization => {local_lexical_variables => ':all_upper', scoped_lexical_variables => ':all_lower'}}
# --- input
# while (blah) {
#     blah;
# }
# continue {
#     my $this_should_be_local_and_not_scoped;
# }

===
--- dscr: Builtin variables and variables in other packages are exempt.
--- failures: 0
--- params: {capitalization => {global_variables => ':all_lower'}}
--- input
local $EVAL_ERROR
local @ARGV;
local %INC;
local $Foo::Bar;

===
--- dscr: Test customization example in the Capitalization POD passing.
--- failures: 0
--- params: {capitalization => {global_variables => 'G_(?:(?!_)\w)+', global_variable_exemptions => '.*THINGY.*'}}
--- input
our $G_FooBar;
our $THINGY;
our @otherTHINGY;

===
--- dscr: Test customization example in the Capitalization POD failing.
--- failures: 4
--- params: {capitalization => {global_variables => 'G_(?:(?!_)\w)+', global_variable_exemptions => '.*THINGY.*'}}
--- input
our $FooBar;
our $G_;
our $G_foo_bar;
our @THING;

===
--- dscr: no lint
--- failures: 3
--- params: {capitalization => {global_variables => 'G_(?:(?!_)\w)+', global_variable_exemptions => '.*THINGY.*'}}
--- input
our $FooBar;
our $G_;
our $G_foo_bar; ## no lint
our @THING;



( run in 2.292 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )