Skip to content

Instantly share code, notes, and snippets.

@sfida11
Last active February 26, 2017 15:26
Show Gist options
  • Save sfida11/4381db788d3438598aa870dda80dd6b1 to your computer and use it in GitHub Desktop.
Save sfida11/4381db788d3438598aa870dda80dd6b1 to your computer and use it in GitHub Desktop.
Perl::Critic(perlcritic)を使用して静的解析、コーディング規約テストを実施(実施編:コマンド) ref: http://qiita.com/sfida11/items/22e6e768a6b4e65bddae
# perlcritic testCode.pl
Code before strictures are enabled at line 1, column 1. See page 429 of PBP. (Severity: 5)
#
# cat testCode.pl
print "Hello world";
#
# perlcritic --exclude=stric testCode.pl
testCode.pl source OK
#
SEVERITY NAME ...is equivalent to... SEVERITY NUMBER
--------------------------------------------------------
--severity gentle --severity 5
--severity stern --severity 4
--severity harsh --severity 3
--severity cruel --severity 2
--severity brutal --severity 1
# perlcritic --severity=2 testCode.pl
Module does not end with "1;" at line 1, column 1. Must end with a recognizable true value. (Severity: 4)
Code not contained in explicit package at line 1, column 1. Violates encapsulation. (Severity: 4)
No package-scoped "$VERSION" variable found at line 1, column 1. See page 404 of PBP. (Severity: 2)
Code before strictures are enabled at line 1, column 1. See page 429 of PBP. (Severity: 5)
Code before warnings are enabled at line 1, column 1. See page 431 of PBP. (Severity: 4)
#
# perlcritic --help
Usage:
perlcritic [-12345 | --brutal | --cruel | --harsh | --stern | --gentle]
[--severity number | name] [{-p | --profile} file | --noprofile]
[--top [ number ]] [--theme expression] [--include pattern]
[--exclude pattern] [{-s | --single-policy} pattern]
[--only | --noonly] [--profile-strictness {warn|fatal|quiet}]
[--force | --noforce] [--statistics] [--statistics-only]
[--count | -C] [--verbose {number | format}] [--allow-unsafe]
[--color | --nocolor] [--pager pager] [--quiet]
[--color-severity-highest color_specification]
[--color-severity-high color_specification]
[--color-severity-medium color_specification]
[--color-severity-low color_specification]
[--color-severity-lowest color_specification]
[--files-with-violations | -l]
[--files-without-violations | -L]
[--program-extensions file_name_extension]
{FILE | DIRECTORY | STDIN}
perlcritic --profile-proto
perlcritic { --list | --list-enabled | --list-themes | --doc pattern [...] }
perlcritic { --help | --options | --man | --version }
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment