From 6417c430fb3db9d090fa6fe028a0e0f6fc49288f Mon Sep 17 00:00:00 2001 From: "Jose D. Gomez R" Date: Mon, 13 Nov 2023 13:11:14 +0100 Subject: [PATCH] Adressing commments from codereview --- .gitignore | 1 - lib/OpenQA/Test/PatchDeparse.pm | 2 -- lib/OpenQA/Test/TimeLimit.pm | 2 -- tools/perlcritic | 14 ++++---------- tools/tidyall | 6 +++--- tools/update-deps | 4 ++-- 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 13eda00..7403810 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -.perltidyrc *.tdy .*.swp *~ diff --git a/lib/OpenQA/Test/PatchDeparse.pm b/lib/OpenQA/Test/PatchDeparse.pm index 9f7a17d..540d1e3 100644 --- a/lib/OpenQA/Test/PatchDeparse.pm +++ b/lib/OpenQA/Test/PatchDeparse.pm @@ -1,6 +1,4 @@ package OpenQA::Test::PatchDeparse; -use strict; -use warnings 'all'; use Test::Most; # Monkeypatch B::Deparse diff --git a/lib/OpenQA/Test/TimeLimit.pm b/lib/OpenQA/Test/TimeLimit.pm index 57cda67..70e349c 100644 --- a/lib/OpenQA/Test/TimeLimit.pm +++ b/lib/OpenQA/Test/TimeLimit.pm @@ -2,8 +2,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later package OpenQA::Test::TimeLimit; -use strict; -use warnings 'all'; use Test::Most; my $SCALE_FACTOR = $ENV{OPENQA_TEST_TIMEOUT_SCALE_FACTOR} // 1; diff --git a/tools/perlcritic b/tools/perlcritic index 52c116d..d67bc0a 100755 --- a/tools/perlcritic +++ b/tools/perlcritic @@ -4,22 +4,16 @@ # # perlcritic with auto-injection of custom perlcritic rules. use strict; -use warnings 'all'; -use Cwd qw(abs_path getcwd); -use File::Basename 'dirname'; -use File::Spec::Functions 'catfile'; +use warnings; +use FindBin '$Bin'; sub extra_include_paths { my @extra_paths = @_; - # using abs_path without arguments so symlinks are not resolved. - # dirname twice to go from `$prj_root/tools/tidyall` to: `$proj_root` - my $prj_root = dirname dirname catfile(abs_path(), __FILE__); my @paths = (); - foreach my $path (@extra_paths) { - push @paths, catfile($prj_root, $path); - push @paths, catfile($prj_root, "external/os-autoinst-common", $path); + push @paths, "$Bin/../$path"; + push @paths, "$Bin/../external/os-autoinst-common/$path"; } # Remove non existing paths diff --git a/tools/tidyall b/tools/tidyall index 08e379b..fa42f72 100755 --- a/tools/tidyall +++ b/tools/tidyall @@ -15,7 +15,7 @@ Grabs the perltidy version from cpanfile using Module::CPANfile. =cut sub perltidy_version { - $_ = Module::CPANfile->load('cpanfile') + my $version = Module::CPANfile->load('cpanfile') ->prereq_for_module('Perl::Tidy') ->requirement ->version; @@ -23,8 +23,8 @@ sub perltidy_version { # is to separate the qualifier from the actual version with a space. # # It's safe enough to assume that the last item is really the version. - @_ = split(' ', $_); - return pop(); + my @version_components = split(' ', $version); + return pop(@version_components); } sub is_force_flag { $_ eq '--force' } diff --git a/tools/update-deps b/tools/update-deps index 56086c5..4d543b6 100755 --- a/tools/update-deps +++ b/tools/update-deps @@ -3,8 +3,8 @@ # SPDX-License-Identifier: GPL-2.0-or-later use strict; -use warnings 'all'; -use 5.26; +use warnings; +use 5.010; use YAML::PP; use Data::Dumper;