Skip to content
Merged
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
14 changes: 7 additions & 7 deletions lib/OpenQA/BuildResults.pm
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ sub filter_subgroups ($group, $subgroup_filter) {
for my $child ($group->children) {
my $full_name = $child->full_name;
if (grep { $_ eq '' || regex_match($_, $full_name) } @$subgroup_filter) {
push(@group_ids, $child->id);
push(@children, $child);
push @group_ids, $child->id;
push @children, $child;
}
}
return {
Expand Down Expand Up @@ -159,8 +159,8 @@ sub compute_build_results ($group, $limit, $time_limit_days, $tags, $subgroup_fi
my @versions;
for my $tag_id (keys %$tags) {
my $tag = $tags->{$tag_id};
push(@builds, $tag->{build}) if $tag->{build};
push(@versions, $tag->{version}) if $tag->{version};
push @builds, $tag->{build} if $tag->{build};
push @versions, $tag->{version} if $tag->{version};
}
$search_filter{BUILD} = {-in => \@builds};
$search_filter{VERSION} = {-in => \@versions} if @versions;
Expand All @@ -172,7 +172,7 @@ sub compute_build_results ($group, $limit, $time_limit_days, $tags, $subgroup_fi
my %versions_per_build;
for my $build (@builds) {
my ($version, $buildnr) = ($build->VERSION, $build->BUILD);
$build->{key} = join('-', $version, $buildnr);
$build->{key} = join '-', $version, $buildnr;
$versions_per_build{$buildnr}->{$version} = 1;
}
if ($buildver_sort_mode == BUILD_SORT_BY_NAME) {
Expand Down Expand Up @@ -234,9 +234,9 @@ sub compute_build_results ($group, $limit, $time_limit_days, $tags, $subgroup_fi
$jr{escaped_version} =~ s/\W/_/g;
$jr{escaped_build} = $jr{build};
$jr{escaped_build} =~ s/\W/_/g;
$jr{escaped_id} = join('-', $jr{escaped_version}, $jr{escaped_build});
$jr{escaped_id} = join '-', $jr{escaped_version}, $jr{escaped_build};
add_review_badge(\%jr);
push(@sorted_results, \%jr);
push @sorted_results, \%jr;
$max_jobs = $jr{total} if ($jr{total} > $max_jobs);
}
$result{max_jobs} = $max_jobs;
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/CLI/api.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use OpenQA::Constants qw(JOBS_OVERVIEW_SEARCH_CRITERIA);

has description => 'Issue an arbitrary request to the API';
has usage => sub {
my $search_criteria = join(', ', JOBS_OVERVIEW_SEARCH_CRITERIA);
my $search_criteria = join ', ', JOBS_OVERVIEW_SEARCH_CRITERIA;
OpenQA::CLI->_help('api') =~ s/\$search_criteria/$search_criteria/r;
};

Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/CLI/schedule.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ has usage => sub { OpenQA::CLI->_help('schedule') };
has post_url => sub { shift->url_for('isos') };

sub _error_from_json ($json) {
return $json->{error} // join("\n", map { $_->{error_message} } @{$json->{failed}});
return $json->{error} // join "\n", map { $_->{error_message} } @{$json->{failed}};
}

sub _populate_job_ids ($self, $results, $job_ids) {
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/CacheService/Controller/Influxdb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sub minion ($self) {

sub _output_measure ($url, $key, $states) {
my $line = "$key,url=$url ";
$line .= join(',', map { "$_=$states->{$_}i" } sort keys %$states);
$line .= join ',', map { "$_=$states->{$_}i" } sort keys %$states;
return $line . "\n";
}

Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/CacheService/Request/Asset.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ has task => 'cache_asset';

# Generate same lock for asset/host
sub lock ($self) {
join('.', map { $self->$_ } qw(asset host));
join '.', map { $self->$_ } qw(asset host);
}

sub to_array ($self) { [$self->id, $self->type, $self->asset, $self->host] }
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/CacheService/Request/Sync.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ has [qw(from to)];
has task => 'cache_tests';

sub lock ($self) {
join('.', map { $self->$_ } qw(from to));
join '.', map { $self->$_ } qw(from to);
}

sub to_array ($self) { [$self->from, $self->to] }
Expand Down
4 changes: 2 additions & 2 deletions lib/OpenQA/Client/Archive.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sub run ($self, $options) {
my $code = $res->code;
die "There's an error openQA client returned $code" unless $code eq 200;

my $job = $res->json->{job} || die('No job could be retrieved');
my $job = $res->json->{job} || die 'No job could be retrieved';

# We have a job now, make a directory in $pwd by default
my $path = path($options->{archive})->make_path;
Expand Down Expand Up @@ -193,7 +193,7 @@ sub _progress_monitior ($ua, $tx) {
$last_updated = time;
if ($progress < $current) {
$progress = $current;
print("\rDownloading $filename: ", $size == $len ? 100 : $progress . '%');
print "\rDownloading $filename: ", $size == $len ? 100 : $progress . '%';
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/Client/Handler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sub _build_url ($self, $uri) {
return $base_url;
}

sub _build_post { $_[0]->client->build_tx(POST => shift()->_build_url(+shift()) => form => +shift()) }
sub _build_post { $_[0]->client->build_tx(POST => shift->_build_url(+shift) => form => +shift) }

sub is_local ($self) { is_host_local($self->_build_url('/')->to_abs->host) }

Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/Command.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ sub client ($self, $url) {

sub data_from_stdin {
vec(my $r = '', fileno(STDIN), 1) = 1;
return !-t STDIN && select($r, undef, undef, 0) ? join '', <STDIN> : '';
return !-t STDIN && (select $r, undef, undef, 0) ? join '', <STDIN> : '';
}

sub decode_args ($self, @args) {
Expand Down
12 changes: 6 additions & 6 deletions lib/OpenQA/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ sub _seek_content ($self, $file_name) {
croak 'No end point is defined' unless defined $self->end();

CORE::open my $file, '<', $file_name or croak "Can't open file $file_name: $!";
binmode($file); # old Perl versions might need this
binmode $file; # old Perl versions might need this
my $ret = my $content = '';
sysseek($file, $self->start(), SEEK_SET);
sysseek $file, $self->start(), SEEK_SET;
$ret = $file->sysread($content, ($self->end() - $self->start()));
croak "Can't read from file $file_name : $!" unless defined $ret;
close($file);
close $file;
return $content;
}

Expand All @@ -129,12 +129,12 @@ sub _write_content ($self, $file_name) {

Mojo::File->new($file_name)->spew('') unless -e $file_name;
CORE::open my $file, '+<', $file_name or croak "Can't open file $file_name: $!";
binmode($file); # old Perl versions might need this
binmode $file; # old Perl versions might need this
my $ret;
sysseek($file, $self->start(), SEEK_SET);
sysseek $file, $self->start(), SEEK_SET;
$ret = $file->syswrite($self->content, ($self->end() - $self->start()));
croak "Can't write to file $file_name : $!" unless defined $ret;
close($file);
close $file;

return $ret;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/Files.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sub deserialize {
return $self->new(map { OpenQA::File->deserialize($_) } @_);
}

sub write { Mojo::File->new(pop())->spew(shift()->join()) }
sub write { Mojo::File->new(pop)->spew(shift->join()) }

sub generate_sum { sha1_base64(shift()->join()) }

Expand Down
4 changes: 2 additions & 2 deletions lib/OpenQA/Git.pm
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ sub commit ($self, $args = undef) {
# stage changes
for my $cmd (qw(add rm)) {
next unless $args->{$cmd};
push(@files, @{$args->{$cmd}});
push @files, @{$args->{$cmd}};
$self->_run_cmd([$cmd, @{$args->{$cmd}}], {croak => "Unable to $cmd via Git"});
}

# commit changes
my $message = $args->{message};
my $author = sprintf('--author=%s <%s>', $self->user->fullname, $self->user->email);
my $author = sprintf '--author=%s <%s>', $self->user->fullname, $self->user->email;
try {
$self->_run_cmd(['commit', '-q', '-m', $message, $author, @files], {croak => 'Unable to commit via Git'});
}
Expand Down
4 changes: 2 additions & 2 deletions lib/OpenQA/JobSettings.pm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ sub _expand_placeholder ($settings, $key, $start, $end, $visited_placeholders_in
return "$start$key$end" if !$on_web_ui && $key eq 'CASEDIR';

# return the key itself and strip one level of % if the key is surrounded by more than one % on any side
return substr($start, 1) . ($key) . substr($end, 0, -1) unless $start eq '%' && $end eq '%';
return (substr $start, 1) . ($key) . (substr $end, 0, -1) unless $start eq '%' && $end eq '%';

# do not replace non-existing keys on web UI level to leave them to the worker
return $on_web_ui ? "$start$key$end" : '' unless defined(my $value = $settings->{$key});
Expand All @@ -90,7 +90,7 @@ sub _expand_placeholder ($settings, $key, $start, $end, $visited_placeholders_in
sub handle_plus_in_settings ($settings) {
for (keys %$settings) {
if (substr($_, 0, 1) eq '+') {
$settings->{substr($_, 1)} = delete $settings->{$_};
$settings->{substr $_, 1} = delete $settings->{$_};
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/OpenQA/LiveHandler/Controller/LiveViewHandler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ sub send_message_to_java_script_clients {
$self->status_java_script_transactions_by_job)
{
if (my $java_script_transactions_for_job = $java_script_transaction_container->{$job_id}) {
push(@all_java_script_transactions_for_job, @$java_script_transactions_for_job);
push @all_java_script_transactions_for_job, @$java_script_transactions_for_job;
}
}

Expand Down Expand Up @@ -507,7 +507,7 @@ sub ws_proxy {
my $java_script_transaction_container
= $status_only ? $self->status_java_script_transactions_by_job : $self->devel_java_script_transactions_by_job;
my $java_script_transactions_for_current_job = ($java_script_transaction_container->{$job_id} //= []);
push(@$java_script_transactions_for_current_job, $java_script_tx);
push @$java_script_transactions_for_current_job, $java_script_tx;

# determine url to os-autoinst command server
my ($cmd_srv_raw_url, $vnc_arg) = $self->determine_connection_params_for_job($job);
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/Log.pm
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ sub redact_settings_in_file ($file) {

sub format_settings ($vars) {
$vars = redact_settings($vars);
return join("\n", map { " $_=$vars->{$_}" } sort keys %$vars);
return join "\n", map { " $_=$vars->{$_}" } sort keys %$vars;
}

1;
2 changes: 1 addition & 1 deletion lib/OpenQA/Markdown.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sub is_light_color {
my $color = shift;
return undef unless $color =~ m/^#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/;
my ($red, $green, $blue) = ($1, $2, $3);
my $sum = hex($red) + hex($green) + hex($blue);
my $sum = (hex $red) + (hex $green) + (hex $blue);
return $sum > 380;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/OpenQA/Parser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ has 'content';
# parser( Format => 'file.json')
# or parser( 'Format' )
sub parser {
@_ > 1 && ref $_[0] ne 'HASH' ? _build_parser(shift(@_))->load(shift(@_)) : _build_parser(shift(@_));
@_ > 1 && ref $_[0] ne 'HASH' ? _build_parser(shift @_)->load(shift @_) : _build_parser(shift @_);
}

sub _build_parser {
Expand Down Expand Up @@ -115,7 +115,7 @@ sub _build_tree {
if (blessed $self->{$collection} && $self->{$collection}->can('each')) {
$self->$collection->each(
sub {
push(@{$tree->{$collection}}, gen_tree_el($_));
push @{$tree->{$collection}}, gen_tree_el($_);
});
}
else {
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/Parser/Format/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ has generated_tests_results => sub {
has generated_tests_output => sub { OpenQA::Parser::Result::OpenQA::Results->new }; #testcase results
has generated_tests_extra => sub { OpenQA::Parser::Result::OpenQA::Results->new }; # tests extra data.

sub parse { shift() } # Do nothing here.
sub parse { shift } # Do nothing here.

sub _write_all {
my ($self, $res, $dir) = @_;
Expand Down
6 changes: 3 additions & 3 deletions lib/OpenQA/Parser/Format/IPA.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ sub parse {
}

# If a test was triggered twice, we need to unique the name
if (exists($unique_names{$t_name})) {
$t_name .= sprintf('_%02d', ++$unique_names{$t_name});
if (exists $unique_names{$t_name}) {
$t_name .= sprintf '_%02d', ++$unique_names{$t_name};
}
else {
$unique_names{$t_name} = 0;
Expand All @@ -60,7 +60,7 @@ sub parse {

my $details = {result => $result->{result}};
my $text_fn = "IPA-$t_name.txt";
my $content = join("\n", $t_name, $result->{result});
my $content = join "\n", $t_name, $result->{result};

$details->{text} = $text_fn;
$details->{title} = $t_name;
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/Parser/Format/KTAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ sub _testgroup_finalize ($self, $result) {
title => $steps->{name},
result => 'ok',
};
$self->_add_output({file => $filename, content => join("\n", @{$steps->{unparsed_lines}})});
$self->_add_output({file => $filename, content => (join "\n", @{$steps->{unparsed_lines}})});
}

$self->generated_tests_results->add(OpenQA::Parser::Result::OpenQA->new($steps));
Expand Down
6 changes: 3 additions & 3 deletions lib/OpenQA/Parser/Result.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ sub new {
return $class->SUPER::new(@args);
}

sub get { OpenQA::Parser::Result::Node->new(val => shift->{shift()}) }
sub get { OpenQA::Parser::Result::Node->new(val => shift->{+shift}) }

sub to_json { encode_json shift() }
sub from_json { shift->new(decode_json shift()) }
sub to_json { encode_json shift }
sub from_json { shift->new(decode_json shift) }

sub to_hash {
my $self = shift;
Expand Down
4 changes: 2 additions & 2 deletions lib/OpenQA/Parser/Results.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ sub new {
}

# Mojo will call TO_JSON
sub to_json { encode_json shift() }
sub from_json { shift->new(@{decode_json shift()}) }
sub to_json { encode_json shift }
sub from_json { shift->new(@{decode_json shift}) }

sub to_array {
my $self = shift;
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/Resource/Jobs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sub job_restart ($jobids, %args) {
my $job_id = $job->id;
my $missing_assets = $job->missing_assets;
if (@$missing_assets) {
my $message = "Job $job_id misses the following mandatory assets: " . join(', ', @$missing_assets);
my $message = "Job $job_id misses the following mandatory assets: " . (join ', ', @$missing_assets);
if ($job->count_related('parents')) {
$message
.= "\nYou may try to retrigger the parent job that should create the assets and will implicitly retrigger this job as well.";
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/Resource/Locks.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ sub barrier_wait ($name = undef, $jobid = undef, $where = undef, $check_dead_job
return @jobs == $barrier->count if grep { $_ eq $jobid } @jobs;

push @jobs, $jobid;
return -1 unless $barriers->update({locked_by => join(',', @jobs)}) > 0;
return -1 unless $barriers->update({locked_by => (join ',', @jobs)}) > 0;
return @jobs == $barrier->count;
}

Expand Down
Loading
Loading