Skip to content

Commit a3106c9

Browse files
committed
All recommended/optional dependencies are now required.
This ensures a consistent & optimal experience for all users. Also, it makes our code a lot simpler since we don't have to generate wrappers that run all the tests without the optional modules. Generally speaking, I feel we should avoid recommended/optional dependencies unless there is a really compelling reason to permit users to not have them (like because they don't work on certain platforms or perls).
1 parent 56136d9 commit a3106c9

8 files changed

+19
-307
lines changed

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ tags
1616
cover_db
1717
lib/Perl/Critic/PolicySummary.pod
1818
nytprof*
19-
t/*_without_optional_dependencies.t
2019
t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run
2120
t/NamingConventions/Capitalization.run
2221
t/Variables/RequireLocalizedPunctuationVars.run
23-
xt/author/generated/t/*_without_optional_dependencies.t
24-
xt/author/generated/xt/author/*_without_optional_dependencies.t

Build.PL

+1-8
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ use lib 'inc';
1212
use Perl::Critic::BuildUtilities qw<
1313
required_module_versions
1414
build_required_module_versions
15-
recommended_module_versions
16-
test_wrappers_to_generate
17-
get_PL_files
18-
dump_unlisted_or_optional_module_versions
1915
emit_tar_warning_if_necessary
16+
get_PL_files
2017
>;
2118
use Perl::Critic::Module::Build;
2219

@@ -36,7 +33,6 @@ my $builder = Perl::Critic::Module::Build->new(
3633

3734
requires => { required_module_versions() },
3835
build_requires => { build_required_module_versions() },
39-
recommends => { recommended_module_versions() },
4036

4137
# Don't require a developer version of Module::Build, even if the
4238
# distribution tarball was created with one. (Oops.)
@@ -86,14 +82,11 @@ my $builder = Perl::Critic::Module::Build->new(
8682
README
8783
>,
8884
values %{ get_PL_files() },
89-
test_wrappers_to_generate(),
9085
],
9186
);
9287

9388
$builder->create_build_script();
9489

95-
dump_unlisted_or_optional_module_versions();
96-
9790

9891
##############################################################################
9992
# Local Variables:

Changes

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ Revision history for Perl module Perl::Critic
77
Also now requires Readonly-2.00, which obviates the need for Readonly::XS
88
to get fast constants.
99

10+
* File::HomeDir, File::Which, and Term::ANSIColor are all required now
11+
instead of being optional or recommended. This simplifies our test code
12+
and ensures consistent optimal behavior for all users.
13+
1014
[New Policies]
1115
* Added two new policies: BuiltinFunctions::ProhibitUselessTopic and
1216
RegularExpressions::ProhibitUselessTopic.

MANIFEST

+3-4
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,6 @@ lib/Test/Perl/Critic/Policy.pm
214214
LICENSE
215215
Makefile.PL
216216
MANIFEST This list of files
217-
META.json
218-
META.yml
219-
README
220217
README.md
221218
t/00_modules.t
222219
t/01_bad_perlcriticrc
@@ -425,4 +422,6 @@ xt/author/94_includes.t
425422
xt/author/95_kwalitee.t
426423
xt/author/98_pod_syntax.t
427424
xt/author/99_pod_coverage.t
428-
xt/author/generate_without_optional_dependencies_wrappers.PL
425+
README
426+
META.yml
427+
META.json

inc/Perl/Critic/BuildUtilities.pm

+5-105
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@ use warnings;
66

77
use English q<-no_match_vars>;
88

9-
our $VERSION = '1.116';
9+
our $VERSION = '1.122';
1010

1111
use Exporter 'import';
1212

1313
our @EXPORT_OK = qw<
1414
required_module_versions
1515
build_required_module_versions
16-
recommended_module_versions
17-
test_wrappers_to_generate
18-
get_PL_files
19-
dump_unlisted_or_optional_module_versions
2016
emit_tar_warning_if_necessary
17+
get_PL_files
2118
>;
2219

2320

@@ -35,10 +32,12 @@ sub required_module_versions {
3532
'Exporter' => 5.63,
3633
'File::Basename' => 0,
3734
'File::Find' => 0,
35+
'File::HomeDir' => 0,
3836
'File::Path' => 0,
3937
'File::Spec' => 0,
4038
'File::Spec::Unix' => 0,
4139
'File::Temp' => 0,
40+
'File::Which' => 0,
4241
'Getopt::Long' => 0,
4342
'IO::String' => 0,
4443
'IPC::Open2' => 1,
@@ -64,6 +63,7 @@ sub required_module_versions {
6463
'Scalar::Util' => 0,
6564
'String::Format' => 1.13,
6665
'Task::Weaken' => 0,
66+
'Term::ANSIColor' => '2.02',
6767
'Test::Builder' => 0.92,
6868
'Text::ParseWords' => 3,
6969
'base' => 0,
@@ -85,62 +85,6 @@ sub build_required_module_versions {
8585
}
8686

8787

88-
sub recommended_module_versions {
89-
return (
90-
'File::HomeDir' => 0,
91-
92-
# If the following changes, the corresponding change needs to be made
93-
# in $Perl::Critic::Utils::Constants::_MODULE_VERSION_TERM_ANSICOLOR.
94-
'Term::ANSIColor' => '2.02',
95-
96-
# All of these are for Documentation::PodSpelling
97-
'File::Which' => 0,
98-
);
99-
}
100-
101-
102-
sub test_wrappers_to_generate {
103-
my @tests_to_be_wrapped = qw<
104-
t/00_modules.t
105-
t/01_config.t
106-
t/01_config_bad_perlcriticrc.t
107-
t/01_policy_config.t
108-
t/02_policy.t
109-
t/03_pragmas.t
110-
t/04_options_processor.t
111-
t/05_utils.t
112-
t/05_utils_ppi.t
113-
t/05_utils_pod.t
114-
t/06_violation.t
115-
t/07_command.t
116-
t/07_perlcritic.t
117-
t/08_document.t
118-
t/09_theme.t
119-
t/10_user_profile.t
120-
t/11_policy_factory.t
121-
t/12_policy_listing.t
122-
t/12_theme_listing.t
123-
t/13_bundled_policies.t
124-
t/14_policy_parameters.t
125-
t/15_statistics.t
126-
t/20_policies.t
127-
t/20_policy_pod_spelling.t
128-
t/20_policy_prohibit_evil_modules.t
129-
t/20_policy_prohibit_hard_tabs.t
130-
t/20_policy_prohibit_trailing_whitespace.t
131-
t/20_policy_require_consistent_newlines.t
132-
t/20_policy_require_tidy_code.t
133-
xt/author/80_policysummary.t
134-
t/92_memory_leaks.t
135-
xt/author/94_includes.t
136-
>;
137-
138-
return
139-
map
140-
{ "xt/author/generated/${_}_without_optional_dependencies.t" }
141-
@tests_to_be_wrapped;
142-
}
143-
14488
my @TARGET_FILES = qw<
14589
t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run
14690
t/NamingConventions/Capitalization.run
@@ -150,41 +94,9 @@ my @TARGET_FILES = qw<
15094
sub get_PL_files {
15195
my %PL_files = map { ( "$_.PL" => $_ ) } @TARGET_FILES;
15296

153-
$PL_files{'xt/author/generate_without_optional_dependencies_wrappers.PL'} =
154-
[ test_wrappers_to_generate() ];
155-
15697
return \%PL_files;
15798
}
15899

159-
sub dump_unlisted_or_optional_module_versions {
160-
print
161-
"\nVersions of optional/unlisted/indirect dependencies:\n\n";
162-
163-
my @unlisted_modules = (
164-
qw<
165-
>,
166-
keys %{ { recommended_module_versions() } },
167-
);
168-
169-
foreach my $module (sort @unlisted_modules) {
170-
my $version;
171-
172-
eval "use $module; \$version = \$${module}::VERSION;";
173-
174-
if ($EVAL_ERROR) {
175-
$version = 'not installed';
176-
} elsif (not defined $version) {
177-
$version = 'undef';
178-
}
179-
180-
print " $module = $version\n";
181-
}
182-
183-
print "\n";
184-
185-
return;
186-
}
187-
188100
sub emit_tar_warning_if_necessary {
189101
if ( os_is( qw<Solaris> ) ) {
190102
print <<'END_OF_TAR_WARNING';
@@ -220,18 +132,6 @@ Various utilities used in assembling Perl::Critic, primary for use by
220132
221133
=over
222134
223-
=item C<recommended_module_versions()>
224-
225-
Returns a hash mapping between recommended (but not required) modules
226-
for Perl::Critic and the minimum version required of each module,
227-
228-
229-
=item C<test_wrappers_to_generate()>
230-
231-
Returns a list of test wrappers to be generated by
232-
F<xt/author/generate_without_optional_dependencies_wrappers.PL>.
233-
234-
235135
=item C<get_PL_files()>
236136
237137
Returns a reference to a hash with a mapping from the name of a .PL

lib/Perl/Critic.pm

+6-8
Original file line numberDiff line numberDiff line change
@@ -876,10 +876,14 @@ L<Email::Address|Email::Address>
876876
877877
L<Exception::Class|Exception::Class>
878878
879+
L<File::HomeDir|File::HomeDir>
880+
879881
L<File::Spec|File::Spec>
880882
881883
L<File::Spec::Unix|File::Spec::Unix>
882884
885+
L<File::Which|File::Which>
886+
883887
L<IO::String|IO::String>
884888
885889
L<List::MoreUtils|List::MoreUtils>
@@ -908,19 +912,13 @@ L<String::Format|String::Format>
908912
909913
L<Task::Weaken|Task::Weaken>
910914
915+
L<Term::ANSIColor|Term::ANSIColor>
916+
911917
L<Text::ParseWords|Text::ParseWords>
912918
913919
L<version|version>
914920
915921
916-
The following modules are optional, but recommended for complete
917-
functionality:
918-
919-
L<File::HomeDir|File::HomeDir>
920-
921-
L<File::Which|File::Which>
922-
923-
924922
=head1 CONTACTING THE DEVELOPMENT TEAM
925923
926924
You are encouraged to subscribe to the mailing list; send a message to

xt/author/82_optional_modules.t

-42
This file was deleted.

0 commit comments

Comments
 (0)