From 163a3fd7264b6de46994fedc3ee286dab60450e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Wed, 16 Dec 2020 12:53:47 +0000 Subject: [PATCH] chore: perlcritic/perltidy passes --- doc/sphinx/build-bastion-conf-help.pl | 34 +++++++++++++------------- lib/perl/OVH/Bastion/configuration.inc | 6 +++-- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/doc/sphinx/build-bastion-conf-help.pl b/doc/sphinx/build-bastion-conf-help.pl index e4e1993..9c3987d 100644 --- a/doc/sphinx/build-bastion-conf-help.pl +++ b/doc/sphinx/build-bastion-conf-help.pl @@ -12,25 +12,26 @@ my @orderedsections; sub dumpdoc { if (!%h) { - ; # nothing to do + ; # nothing to do } elsif (defined $h{param} && defined $h{default} && defined $h{desc} && defined $h{type}) { die "attempting to dump data but section=$section" if !$section; - push @{ $sections{$section} }, $h{param}; + push @{$sections{$section}}, $h{param}; push @out, ".. _bastion_conf_$h{param}:\n"; push @out, "\n"; push @out, "$h{param}\n"; my $len = length($h{param}); - push @out, "*"x$len."\n\n"; + push @out, "*" x $len . "\n\n"; push @out, ":Type: ``$h{type}``\n\n"; push @out, ":Default: ``$h{default}``\n\n"; push @out, ":Example: ``$h{example}``\n\n" if $h{example}; push @out, "$h{desc}\n\n"; } else { - die "something is missing: ".($h{param}?"":"param ").($h{default}?"":"default ").($h{desc}?"":"desc ").($h{type}?"":"type")."\n"; + die "something is missing: " . ($h{param} ? "" : "param ") . ($h{default} ? "" : "default ") . ($h{desc} ? "" : "desc ") . ($h{type} ? "" : "type") . "\n"; } %h = (); + return; } my $state = ''; @@ -39,8 +40,8 @@ while (<>) { next if /^\s*$/; if (m{^# ([a-zA-Z0-9_]+) \((.+)\)}) { $h{param} = $1; - $h{type} = $2; - $state = 'name'; + $h{type} = $2; + $state = 'name'; } elsif (m{^#\s+DESC:\s+(.+)$}) { $h{desc} = $1; @@ -64,10 +65,10 @@ while (<>) { elsif (m{^# > (.+)$}) { if (%h or $state) { die "new section '$1' but we have pending data"; } $section = $1; - $state = 'section'; + $state = 'section'; push @orderedsections, $section; - push @out, "$1\n"; - push @out, "-"x(length($1))."\n\n"; + push @out, "$1\n"; + push @out, "-" x (length($1)) . "\n\n"; } elsif (m{^# >> (.+)$} and $state eq 'section' and $section) { $sectiondesc{$section} = $1; @@ -78,7 +79,7 @@ while (<>) { } dumpdoc(); -print <{$o}) eq lc($_) } qw{ no false disabled }) { + elsif (grep { lc($C->{$o}) eq lc } qw{ no false disabled }) { push @errors, "Configuration error: found value '" . $C->{$o} . "' for option '$o', but it's supposed to be a boolean, assuming false"; $C->{$o} = 0; } @@ -294,7 +294,9 @@ sub load_configuration { # 5/6) Arrays whose values should match a specific regex. foreach my $o ( - {name => 'allowedIngressSshAlgorithms', default => [qw{ rsa ecdsa ed25519 }], validre => qr/^(rsa|ecdsa|ed25519)$/}, + ## no critic(RegularExpressions::ProhibitFixedStringMatches) + {name => 'allowedIngressSshAlgorithms', default => [qw{ rsa ecdsa ed25519 }], validre => qr/^(rsa|ecdsa|ed25519)$/}, + ## no critic(RegularExpressions::ProhibitFixedStringMatches) {name => 'allowedEgressSshAlgorithms', default => [qw{ rsa ecdsa ed25519 }], validre => qr/^(rsa|ecdsa|ed25519)$/}, {name => 'accountCreateSupplementaryGroups', default => [], validre => qr/^(.*)$/}, {name => 'accountCreateDefaultPersonalAccesses', default => [], validre => qr/^(.*)$/},