Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply perlimports to tests #119

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions perlimports.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Valid log levels are:
# debug, info, notice, warning, error, critical, alert, emergency
# critical, alert and emergency are not currently used.
#
# Please use boolean values in this config file. Negated options (--no-*) are
# not permitted here. Explicitly set options to true or false.
#
# Some of these values deviate from the regular perlimports defaults. In
# particular, you're encouraged to leave preserve_duplicates and
# preserve_unused disabled.

cache = false # setting this to true is currently discouraged
ignore_modules = [
"lib::relative",
"Code::TidyAll::CacheModel::Shared",
"Test::Class::Most",
"Test::More",
]
ignore_modules_filename = ""
ignore_modules_pattern = "" # regex like "^(Foo|Foo::Bar)"
ignore_modules_pattern_filename = ""
libs = ["lib", "t/lib"]
log_filename = ""
log_level = "warn"
never_export_modules = []
never_export_modules_filename = ""
padding = true
preserve_duplicates = false
preserve_unused = false
tidy_whitespace = true
6 changes: 3 additions & 3 deletions t/Basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use warnings;

use lib::relative 'lib';

use Config;
use File::Spec;
use Config qw( %Config );
use File::Spec ();

# We need to make sure that t/lib is seen across forks _and_ we want to make
# sure that the paths are absolute because Code::TidyAll may chdir while
Expand All @@ -20,5 +20,5 @@ $ENV{PERL5LIB} = join(
)
);

use TestFor::Code::TidyAll::Basic;
use TestFor::Code::TidyAll::Basic ();
TestFor::Code::TidyAll::Basic->runtests;
2 changes: 1 addition & 1 deletion t/Conf.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Conf;
use TestFor::Code::TidyAll::Conf ();
TestFor::Code::TidyAll::Conf->runtests;
2 changes: 1 addition & 1 deletion t/Git.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Git;
use TestFor::Code::TidyAll::Git ();
$ENV{LC_ALL} = 'C';
TestFor::Code::TidyAll::Git->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-CSSUnminifier.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::CSSUnminifier;
use TestFor::Code::TidyAll::Plugin::CSSUnminifier ();
TestFor::Code::TidyAll::Plugin::CSSUnminifier->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-GenericTransformer.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::GenericTransformer;
use TestFor::Code::TidyAll::Plugin::GenericTransformer ();
TestFor::Code::TidyAll::Plugin::GenericTransformer->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-GenericValidator.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::GenericValidator;
use TestFor::Code::TidyAll::Plugin::GenericValidator ();
TestFor::Code::TidyAll::Plugin::GenericValidator->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-JSBeautify.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/perl
use lib::relative 'lib';
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::JSBeautify;
use TestFor::Code::TidyAll::Plugin::JSBeautify ();
TestFor::Code::TidyAll::Plugin::JSBeautify->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-JSHint.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::JSHint;
use TestFor::Code::TidyAll::Plugin::JSHint ();
TestFor::Code::TidyAll::Plugin::JSHint->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-JSLint.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::JSLint;
use TestFor::Code::TidyAll::Plugin::JSLint ();
TestFor::Code::TidyAll::Plugin::JSLint->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-MasonTidy.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::MasonTidy;
use TestFor::Code::TidyAll::Plugin::MasonTidy ();
TestFor::Code::TidyAll::Plugin::MasonTidy->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-PHPCodeSniffer.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::PHPCodeSniffer;
use TestFor::Code::TidyAll::Plugin::PHPCodeSniffer ();
TestFor::Code::TidyAll::Plugin::PHPCodeSniffer->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-PerlCritic.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::PerlCritic;
use TestFor::Code::TidyAll::Plugin::PerlCritic ();
TestFor::Code::TidyAll::Plugin::PerlCritic->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-PerlTidy.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::PerlTidy;
use TestFor::Code::TidyAll::Plugin::PerlTidy ();
TestFor::Code::TidyAll::Plugin::PerlTidy->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-PerlTidySweet.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ plan skip_all => 'This plugin requires Perl 5.10+'
unless $] >= 5.010;

use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::PerlTidySweet;
use TestFor::Code::TidyAll::Plugin::PerlTidySweet ();
TestFor::Code::TidyAll::Plugin::PerlTidySweet->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-PodChecker.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::PodChecker;
use TestFor::Code::TidyAll::Plugin::PodChecker ();
TestFor::Code::TidyAll::Plugin::PodChecker->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-PodSpell.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::PodSpell;
use TestFor::Code::TidyAll::Plugin::PodSpell ();
TestFor::Code::TidyAll::Plugin::PodSpell->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-PodTidy.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::PodTidy;
use TestFor::Code::TidyAll::Plugin::PodTidy ();
TestFor::Code::TidyAll::Plugin::PodTidy->runtests;
2 changes: 1 addition & 1 deletion t/Plugin-SortLines.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Plugin::SortLines;
use TestFor::Code::TidyAll::Plugin::SortLines ();
TestFor::Code::TidyAll::Plugin::SortLines->runtests;
2 changes: 1 addition & 1 deletion t/Util.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Util;
use TestFor::Code::TidyAll::Util ();
TestFor::Code::TidyAll::Util->runtests;
2 changes: 1 addition & 1 deletion t/Zglob.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::Util::Zglob;
use TestFor::Code::TidyAll::Util::Zglob ();
TestFor::Code::TidyAll::Util::Zglob->runtests;
2 changes: 1 addition & 1 deletion t/diff-on-tidy-error.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
use lib::relative 'lib';
use TestFor::Code::TidyAll::DiffOnTidyError;
use TestFor::Code::TidyAll::DiffOnTidyError ();
TestFor::Code::TidyAll::DiffOnTidyError->runtests;
2 changes: 1 addition & 1 deletion t/helper-bin/generic-transformer.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Path::Tiny qw/ path /;
use Path::Tiny qw( path );

my $content = path(shift)->slurp;
$content =~ s/forbidden/safe/i;
Expand Down
2 changes: 1 addition & 1 deletion t/helper-bin/generic-validator.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use strict;
use warnings;

use Path::Tiny qw/ path /;
use Path::Tiny qw( path );
exit 1 if path(shift)->slurp =~ /forbidden/i;
18 changes: 9 additions & 9 deletions t/lib/TestFor/Code/TidyAll/Basic.pm
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package TestFor::Code::TidyAll::Basic;

use Capture::Tiny qw(capture capture_stdout capture_merged);
use Capture::Tiny qw( capture_merged capture_stdout );
use Code::TidyAll::CacheModel::Shared;
use Code::TidyAll::Util qw(tempdir_simple);
use Code::TidyAll;
use File::Find qw(find);
use File::pushd qw(pushd);
use FindBin qw( $Bin );
use IPC::Run3 qw( run3 );
use Path::Tiny qw(path);
use Code::TidyAll::Util qw( tempdir_simple );
use Code::TidyAll ();
use File::Find qw( find );
use File::pushd qw( pushd );
use FindBin qw( $Bin );
use IPC::Run3 qw( run3 );
use Path::Tiny qw( path );

use Test::Class::Most parent => 'TestHelper::Test::Class';
use Test::Fatal;
use Test::Fatal qw( exception );
use Test::Warnings;

sub test_plugin {"+TestHelper::Plugin::$_[0]"}
Expand Down
4 changes: 2 additions & 2 deletions t/lib/TestFor/Code/TidyAll/Conf.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package TestFor::Code::TidyAll::Conf;

use Code::TidyAll;
use Code::TidyAll::Util qw(tempdir_simple);
use Code::TidyAll ();
use Code::TidyAll::Util qw( tempdir_simple );
use Test::Class::Most parent => 'TestHelper::Test::Class';

my @tests = (
Expand Down
20 changes: 10 additions & 10 deletions t/lib/TestFor/Code/TidyAll/Git.pm
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package TestFor::Code::TidyAll::Git;

use Capture::Tiny qw(capture capture_stderr);
use Code::TidyAll::Git::Util qw(git_files_to_commit git_modified_files);
use Code::TidyAll::Util qw(tempdir_simple);
use Code::TidyAll;
use File::pushd qw(pushd);
use File::Spec;
use FindBin qw( $Bin );
use IPC::System::Simple qw(capturex runx);
use Path::Tiny qw(path);
use Capture::Tiny qw( capture capture_stderr );
use Code::TidyAll::Git::Util qw( git_files_to_commit git_modified_files );
use Code::TidyAll::Util qw( tempdir_simple );
use Code::TidyAll ();
use File::pushd qw( pushd );
use File::Spec ();
use FindBin qw( $Bin );
use IPC::System::Simple qw( capturex runx );
use Path::Tiny qw( path );
use Test::Class::Most parent => 'TestHelper::Test::Class';
use Try::Tiny;
use Try::Tiny qw( catch try );

use constant IS_WIN32 => $^O eq 'MSWin32';

Expand Down
2 changes: 1 addition & 1 deletion t/lib/TestFor/Code/TidyAll/Parallel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use strict;
use warnings;

use Module::Runtime qw( require_module );
use Try::Tiny;
use Try::Tiny qw( try );

BEGIN {
for my $mod (qw( Parallel::ForkManager )) {
Expand Down
8 changes: 4 additions & 4 deletions t/lib/TestFor/Code/TidyAll/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use strict;
use warnings;
use autodie;

use Capture::Tiny qw(capture);
use Code::TidyAll::Util qw(tempdir_simple);
use Code::TidyAll;
use Path::Tiny qw(path);
use Capture::Tiny qw( capture );
use Code::TidyAll::Util qw( tempdir_simple );
use Code::TidyAll ();
use Path::Tiny qw( path );
use Test::Class::Most parent => 'TestHelper::Test::Class';
use Test::Differences qw( eq_or_diff );

Expand Down
2 changes: 1 addition & 1 deletion t/lib/TestFor/Code/TidyAll/Plugin/JSBeautify.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package TestFor::Code::TidyAll::Plugin::JSBeautify;

use Encode qw(encode);
use Encode qw( encode );
use Path::Tiny qw( cwd );
use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';
use Test::Warnings qw( warnings );
Expand Down
2 changes: 1 addition & 1 deletion t/lib/TestFor/Code/TidyAll/Plugin/MasonTidy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package TestFor::Code::TidyAll::Plugin::MasonTidy;
use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';

use Module::Runtime qw( require_module );
use Try::Tiny;
use Try::Tiny qw( try );

BEGIN {
for my $mod (qw( Mason::Tidy )) {
Expand Down
4 changes: 1 addition & 3 deletions t/lib/TestFor/Code/TidyAll/Plugin/PerlCritic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package TestFor::Code::TidyAll::Plugin::PerlCritic;

use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';

use Code::TidyAll::Plugin::PerlCritic;
use Module::Runtime qw( require_module );
use Try::Tiny;
use Code::TidyAll::Plugin::PerlCritic ();

sub test_main : Tests {
my $self = shift;
Expand Down
4 changes: 2 additions & 2 deletions t/lib/TestFor/Code/TidyAll/Plugin/PerlTidy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package TestFor::Code::TidyAll::Plugin::PerlTidy;

use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';

use Getopt::Long;
use Getopt::Long ();
use Module::Runtime qw( require_module );
use Try::Tiny;
use Try::Tiny qw( try );

BEGIN {
for my $mod (qw( Perl::Tidy )) {
Expand Down
2 changes: 1 addition & 1 deletion t/lib/TestFor/Code/TidyAll/Plugin/PerlTidySweet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package TestFor::Code::TidyAll::Plugin::PerlTidySweet;
use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';

use Module::Runtime qw( require_module );
use Try::Tiny;
use Try::Tiny qw( try );

BEGIN {
for my $mod (qw( Perl::Tidy::Sweetened )) {
Expand Down
2 changes: 1 addition & 1 deletion t/lib/TestFor/Code/TidyAll/Plugin/PodChecker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package TestFor::Code::TidyAll::Plugin::PodChecker;
use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';

use Module::Runtime qw( require_module );
use Try::Tiny;
use Try::Tiny qw( try );

BEGIN {
for my $mod (qw( Pod::Checker )) {
Expand Down
2 changes: 1 addition & 1 deletion t/lib/TestFor/Code/TidyAll/Plugin/PodSpell.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package TestFor::Code::TidyAll::Plugin::PodSpell;
use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';

use Module::Runtime qw( require_module );
use Try::Tiny;
use Try::Tiny qw( try );

BEGIN {
for my $mod (qw( Pod::Spell )) {
Expand Down
2 changes: 1 addition & 1 deletion t/lib/TestFor/Code/TidyAll/Plugin/PodTidy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package TestFor::Code::TidyAll::Plugin::PodTidy;
use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';

use Module::Runtime qw( require_module );
use Try::Tiny;
use Try::Tiny qw( try );

BEGIN {
for my $mod (qw( Pod::Tidy )) {
Expand Down
12 changes: 6 additions & 6 deletions t/lib/TestFor/Code/TidyAll/SVN.pm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package TestFor::Code::TidyAll::SVN;

use Capture::Tiny qw(capture_stdout capture_stderr capture);
use Capture::Tiny qw( capture_stderr capture_stdout );
use Code::TidyAll::SVN::Precommit;
use Code::TidyAll::SVN::Util qw(svn_uncommitted_files);
use Code::TidyAll::Util qw(tempdir_simple);
use Code::TidyAll;
use IPC::System::Simple qw(run);
use Path::Tiny qw(path);
use Code::TidyAll::SVN::Util qw( svn_uncommitted_files );
use Code::TidyAll::Util qw( tempdir_simple );
use Code::TidyAll ();
use IPC::System::Simple qw( run );
use Path::Tiny qw( path );
use Test::Class::Most parent => 'TestHelper::Test::Class';

my ( $precommit_hook_template, $tidyall_ini_template );
Expand Down
9 changes: 4 additions & 5 deletions t/lib/TestFor/Code/TidyAll/SpacesInPaths.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ use warnings;

use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';

use Code::TidyAll::Plugin::PerlCritic;
use Code::TidyAll::Util qw(tempdir_simple);
use Module::Runtime qw( require_module );
use Path::Tiny qw( cwd );
use Try::Tiny;
use Code::TidyAll::Plugin::PerlCritic ();
use Module::Runtime qw( require_module );
use Path::Tiny qw( cwd );
use Try::Tiny qw( try );

BEGIN {
my @mods
Expand Down
4 changes: 2 additions & 2 deletions t/lib/TestFor/Code/TidyAll/Util.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package TestFor::Code::TidyAll::Util;

use Code::TidyAll::Util qw(tempdir_simple);
use Path::Tiny;
use Code::TidyAll::Util qw( tempdir_simple );
use Path::Tiny qw( path );
use Test::Class::Most parent => 'TestHelper::Test::Class';

sub test_tempdir_simple : Tests {
Expand Down
Loading