Skip to content

Commit

Permalink
[perlcritic] fix some severity 4 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cgzones committed Aug 21, 2018
1 parent 37cb6ac commit 5478e5c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .perlcriticrc
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,12 @@ severity = 5

[Variables::ProhibitUnusedVariables]
severity = 5

[Modules::ProhibitMultiplePackages]
severity = 5

[Modules::RequireEndWithOne]
severity = 5

[ValuesAndExpressions::ProhibitConstantPragma]
severity = 5
2 changes: 1 addition & 1 deletion lib/Munin/Common/Defaults.pm.PL
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ print $fh <<'EOF';
sub get_defaults {
my ($class) = @_;
## no critic
## no critic qw(TestingAndDebugging::ProhibitNoStrict)
no strict 'refs';
my $defaults = {};
Expand Down
1 change: 1 addition & 0 deletions lib/Munin/Master/Node.pm
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ sub _merge_into_str_no_dup
}

# Defines the URL::scheme for munin
## no critic qw(Modules::ProhibitMultiplePackages)
package URI::munin;

# We are like a generic server
Expand Down
13 changes: 7 additions & 6 deletions lib/Munin/Node/SpoolWriter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ use Munin::Common::Utils qw( is_valid_hostname );

use Params::Validate qw( :all );
use List::Util qw( first );
use Readonly;

use constant DEFAULT_TIME => 86_400; # put 1 day of results into a spool file
use constant MAXIMUM_AGE => 7; # remove spool files more than a week old
use constant DEFAULT_HOSTNAME => 'munin.example.com';
Readonly my $DEFAULT_TIME => 86_400; # put 1 day of results into a spool file
Readonly my $MAXIMUM_AGE => 7; # remove spool files more than a week old
Readonly my $DEFAULT_HOSTNAME => 'munin.example.com';

sub _snap_to_epoch_boundary { my $self = shift; return $_[0] - ($_[0] % $self->{interval_size}) }

Expand Down Expand Up @@ -50,19 +51,19 @@ sub new {
$self->{interval_size} = first { defined($_) and $_ > 0 } (
$validated->{interval_size},
$self->{metadata}->{interval_size},
DEFAULT_TIME
$DEFAULT_TIME
);

$self->{interval_keep} = first { defined($_) and $_ > 0 } (
$validated->{interval_keep},
$self->{metadata}->{interval_keep},
MAXIMUM_AGE,
$MAXIMUM_AGE,
);

$self->{hostname} = first { defined($_) and is_valid_hostname($_) } (
$validated->{hostname},
$self->{metadata}->{hostname},
DEFAULT_HOSTNAME,
$DEFAULT_HOSTNAME,
);

return $self;
Expand Down
2 changes: 2 additions & 0 deletions lib/Munin/Plugin/Framework.pm
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,5 @@ sub run {
}
}
}

1;
2 changes: 2 additions & 0 deletions lib/Munin/Plugin/HTTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@ sub get_basic_credentials {

return $isproxy ? () : ($ENV{'http_username'}, $ENV{'http_password'});
}

1;
2 changes: 0 additions & 2 deletions script/munin-httpd
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ sub handle_request
}
}

package main;

$ENV{PATH} = '/usr/bin:/bin';

# start the server on port 4948
Expand Down

0 comments on commit 5478e5c

Please sign in to comment.