Commit | Line | Data |
---|---|---|
1479465f GJ |
1 | #!/usr/bin/perl |
2 | # | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 2 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program. If not, see <https://www.gnu.org/licenses/>. | |
15 | ||
16 | use strict; | |
17 | use warnings; | |
18 | ||
19 | use Test::More; | |
20 | use Test::Dpkg qw(:needs); | |
21 | ||
22 | test_needs_author(); | |
23 | test_needs_module('Test::Perl::Critic'); | |
24 | test_needs_srcdir_switch(); | |
25 | ||
26 | my @policies = qw( | |
27 | BuiltinFunctions::ProhibitBooleanGrep | |
28 | BuiltinFunctions::ProhibitLvalueSubstr | |
29 | BuiltinFunctions::ProhibitReverseSortBlock | |
30 | BuiltinFunctions::ProhibitSleepViaSelect | |
31 | BuiltinFunctions::ProhibitStringySplit | |
32 | BuiltinFunctions::ProhibitUniversalCan | |
33 | BuiltinFunctions::ProhibitUniversalIsa | |
34 | BuiltinFunctions::ProhibitUselessTopic | |
35 | BuiltinFunctions::ProhibitVoidGrep | |
36 | BuiltinFunctions::ProhibitVoidMap | |
37 | BuiltinFunctions::RequireBlockGrep | |
38 | BuiltinFunctions::RequireBlockMap | |
39 | BuiltinFunctions::RequireGlobFunction | |
40 | BuiltinFunctions::RequireSimpleSortBlock | |
41 | ClassHierarchies::ProhibitAutoloading | |
42 | ClassHierarchies::ProhibitExplicitISA | |
43 | ClassHierarchies::ProhibitOneArgBless | |
44 | CodeLayout::ProhibitHardTabs | |
45 | CodeLayout::ProhibitQuotedWordLists | |
46 | CodeLayout::ProhibitTrailingWhitespace | |
47 | CodeLayout::RequireConsistentNewlines | |
48 | ControlStructures::ProhibitCStyleForLoops | |
49 | ControlStructures::ProhibitLabelsWithSpecialBlockNames | |
50 | ControlStructures::ProhibitMutatingListFunctions | |
51 | ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions | |
52 | ControlStructures::ProhibitUntilBlocks | |
53 | Documentation::RequirePackageMatchesPodName | |
54 | InputOutput::ProhibitBarewordFileHandles | |
55 | InputOutput::ProhibitInteractiveTest | |
56 | InputOutput::ProhibitJoinedReadline | |
57 | InputOutput::ProhibitOneArgSelect | |
58 | InputOutput::ProhibitReadlineInForLoop | |
59 | InputOutput::ProhibitTwoArgOpen | |
60 | InputOutput::RequireBracedFileHandleWithPrint | |
61 | InputOutput::RequireCheckedOpen | |
62 | InputOutput::RequireEncodingWithUTF8Layer | |
63 | Miscellanea::ProhibitFormats | |
64 | Miscellanea::ProhibitUnrestrictedNoCritic | |
65 | Miscellanea::ProhibitUselessNoCritic | |
66 | Modules::ProhibitConditionalUseStatements | |
67 | Modules::ProhibitEvilModules | |
68 | Modules::RequireBarewordIncludes | |
69 | Modules::RequireEndWithOne | |
70 | Modules::RequireExplicitPackage | |
71 | Modules::RequireFilenameMatchesPackage | |
72 | NamingConventions::Capitalization | |
73 | Objects::ProhibitIndirectSyntax | |
74 | RegularExpressions::ProhibitSingleCharAlternation | |
75 | RegularExpressions::ProhibitUnusedCapture | |
76 | RegularExpressions::ProhibitUnusualDelimiters | |
77 | RegularExpressions::ProhibitUselessTopic | |
78 | RegularExpressions::RequireBracesForMultiline | |
79 | RegularExpressions::RequireExtendedFormatting | |
80 | Subroutines::ProhibitExplicitReturnUndef | |
81 | Subroutines::ProhibitNestedSubs | |
82 | Subroutines::ProhibitReturnSort | |
83 | Subroutines::ProhibitUnusedPrivateSubroutines | |
84 | Subroutines::ProtectPrivateSubs | |
85 | TestingAndDebugging::ProhibitNoStrict | |
86 | TestingAndDebugging::ProhibitNoWarnings | |
87 | TestingAndDebugging::RequireTestLabels | |
88 | TestingAndDebugging::RequireUseStrict | |
89 | TestingAndDebugging::RequireUseWarnings | |
90 | ValuesAndExpressions::ProhibitCommaSeparatedStatements | |
91 | ValuesAndExpressions::ProhibitComplexVersion | |
92 | ValuesAndExpressions::ProhibitInterpolationOfLiterals | |
93 | ValuesAndExpressions::ProhibitLongChainsOfMethodCalls | |
94 | ValuesAndExpressions::ProhibitMismatchedOperators | |
95 | ValuesAndExpressions::ProhibitMixedBooleanOperators | |
96 | ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters | |
97 | ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator | |
98 | ValuesAndExpressions::ProhibitVersionStrings | |
99 | ValuesAndExpressions::RequireConstantVersion | |
100 | ValuesAndExpressions::RequireQuotedHeredocTerminator | |
101 | ValuesAndExpressions::RequireUpperCaseHeredocTerminator | |
102 | Variables::ProhibitAugmentedAssignmentInDeclaration | |
103 | Variables::ProhibitConditionalDeclarations | |
104 | Variables::ProhibitLocalVars | |
105 | Variables::ProhibitMatchVars | |
106 | Variables::ProhibitPackageVars | |
107 | Variables::ProhibitPerl4PackageNames | |
108 | Variables::ProhibitUnusedVariables | |
109 | Variables::ProtectPrivateVars | |
110 | Variables::RequireLexicalLoopIterators | |
111 | Variables::RequireNegativeIndices | |
112 | ); | |
113 | ||
114 | Test::Perl::Critic->import( | |
115 | -profile => 't/critic/perlcriticrc', | |
116 | -verbose => 8, | |
117 | -include => \@policies, | |
118 | -only => 1, | |
119 | ); | |
120 | ||
121 | my @files = Test::Dpkg::all_perl_files(); | |
122 | ||
123 | plan tests => scalar @files; | |
124 | ||
125 | for my $file (@files) { | |
126 | critic_ok($file); | |
127 | } |