Skip to content

Commit 37380d0

Browse files
authored
Merge pull request #6398 from perlpunk/tidy-blank-sub
tidy: Enforce blank lines before subs
2 parents 12f3e8e + 0d48285 commit 37380d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+173
-122
lines changed

.perltidyrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--character-encoding=none
44
--no-valign
55
-l=120 # 120 characters per line
6-
-fbl # don't change blank lines
6+
--noblanks-before-comments
77
-nsfs # no spaces before semicolons
88
-baao # space after operators
99
-bbao # space before operators
@@ -12,3 +12,6 @@
1212
-sbt=2 # no spaces around {}
1313
-sct # stack closing tokens )}
1414
--pack-operator-types='->' # allow chained method calls on one line
15+
--blanks-before-subs
16+
--keep-old-blank-lines=2 # keep all blank lines
17+
--noblanks-before-blocks

lib/OpenQA/Jobs/Constants.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ my %META_RESULT_MAPPING = (
168168
);
169169
sub meta_state ($state) { $META_STATE_MAPPING{$state} // NONE }
170170
sub meta_result ($result) { $META_RESULT_MAPPING{$result} // NONE }
171+
171172
sub is_ok_result ($result) {
172173
!!grep { $result eq $_ } OK_RESULTS;
173174
}

lib/OpenQA/Parser/Format/IPA.pm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ sub parse {
8787
$self;
8888
}
8989

90-
{
91-
package OpenQA::Parser::Result::IPA::Info;
90+
package OpenQA::Parser::Result::IPA::Info {
9291
use Mojo::Base 'OpenQA::Parser::Result';
9392

9493
has [qw(distro platform image instance region results_file log_file timestamp)];

lib/OpenQA/Parser/Format/JUnit.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ has include_results => 0;
1313

1414
# Override to use specific OpenQA Result class.
1515
sub _add_single_result { shift->generated_tests_results->add(OpenQA::Parser::Result::OpenQA->new(@_)) }
16+
1617
sub _add_result {
1718
my $self = shift;
1819
my %opts = ref $_[0] eq 'HASH' ? %{$_[0]} : @_;

lib/OpenQA/Parser/Format/LTP.pm

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ sub parse {
8282
}
8383

8484
# Schema
85-
{
86-
package OpenQA::Parser::Result::LTP::Test;
85+
package OpenQA::Parser::Result::LTP::Test {
8786
use Mojo::Base 'OpenQA::Parser::Result::OpenQA';
8887

8988
has environment => sub { OpenQA::Parser::Result::LTP::Environment->new() };
@@ -92,15 +91,13 @@ sub parse {
9291
}
9392

9493
# Additional data structure - they get mapped automatically
95-
{
96-
package OpenQA::Parser::Result::LTP::SubTest;
94+
package OpenQA::Parser::Result::LTP::SubTest {
9795
use Mojo::Base 'OpenQA::Parser::Result::Test';
9896

9997
has [qw(log duration result)];
10098
}
10199

102-
{
103-
package OpenQA::Parser::Result::LTP::Environment;
100+
package OpenQA::Parser::Result::LTP::Environment {
104101
use Mojo::Base 'OpenQA::Parser::Result';
105102

106103
has [qw(gcc product revision kernel ltp_version harness libc arch)];

lib/OpenQA/Parser/Format/XUnit.pm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,14 @@ sub parse {
103103
}
104104

105105
# Schema
106-
{
107-
package OpenQA::Parser::Result::XUnit;
106+
package OpenQA::Parser::Result::XUnit {
108107
use Mojo::Base 'OpenQA::Parser::Result::OpenQA';
109108
has properties => sub { OpenQA::Parser::Results->new };
110109

111110
has [qw(errors tests softfailures failures time)];
112111
}
113112

114-
{
115-
package OpenQA::Parser::Result::XUnit::Property;
113+
package OpenQA::Parser::Result::XUnit::Property {
116114
use Mojo::Base 'OpenQA::Parser::Result';
117115

118116
has [qw(name value)];

lib/OpenQA/Resource/Jobs.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Handle job restart by user (using API or WebUI). Job is only restarted when eith
2828
or done. Scheduled jobs can't be restarted.
2929
3030
=cut
31+
3132
sub job_restart ($jobids, %args) {
3233
my (@duplicates, @comments, @processed, @errors, @warnings);
3334
my %res = (

lib/OpenQA/Scheduler/Model/Jobs.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ sub _serialize_directly_chained_job_sequence ($first_job_id, $cluster_info, $sor
499499
$cluster_info, $sort_function // sub { return shift });
500500
return ($sequence, [keys %visited]);
501501
}
502+
502503
sub _serialize_directly_chained_job_sub_sequence ($output_array, $visited, $child_job_ids, $cluster_info,
503504
$sort_function)
504505
{

lib/OpenQA/Schema/Result/Comments.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ sub bugrefs ($self) { find_bugrefs($self->text) }
104104
105105
Returns label value if C<$self> is label, e.g. 'label:my_label' returns 'my_label'
106106
=cut
107+
107108
sub label ($self) {
108109
return find_labels($self->text)->[0];
109110
}
@@ -112,6 +113,7 @@ sub label ($self) {
112113
113114
Returns flag values if C<$self> has flags, e.g. 'flag:carryover flag:foobar' returns a hashref with the keys 'carryover' and 'foobar'
114115
=cut
116+
115117
sub text_flags ($self) {
116118
my $flags = find_flags($self->text);
117119
my %flag_hash;
@@ -143,6 +145,7 @@ comments not on test comments. The description is optional.
143145
Returns C<build_nr>, C<type> and optionally C<description> if C<$self> is tag,
144146
e.g. 'tag:0123:important:GM' returns a list of '0123', 'important' and 'GM'.
145147
=cut
148+
146149
sub tag ($self) {
147150
$self->text
148151
=~ /\btag:(((?<version>[-.@\d\w]+)-)?(?<build>[-.@\d\w]+)|"((?<version>[-.@\d\w]+)-)?(?<build>[-.@\d\w\s\+:]+)"):(?<type>[-@\d\w]+)(:(?<description>[-.@\d\w]+))?\b/;

lib/OpenQA/Schema/Result/Jobs.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ sub extract_group_args_from_settings ($settings) {
604604
Internal function, needs to be executed in a transaction to perform
605605
optimistic locking on clone_id
606606
=cut
607+
607608
sub _create_clone ($self, $cluster_job_info, $clone, $prio, $skip_ok_result_children, $settings) {
608609
# Skip cloning 'ok' jobs which are only pulled in as children if that flag is set
609610
return ()
@@ -903,6 +904,7 @@ for DIRECTLY_CHAINED dependencies:
903904
+ if child is clone, find the latest clone and clone it
904905
905906
=cut
907+
906908
sub duplicate ($self, $args = {}) {
907909
# If the job already has a clone, none is created
908910
my ($orig_id, $clone_id) = ($self->id, $self->clone_id);
@@ -966,6 +968,7 @@ Handle individual job restart including dependent jobs and asset dependencies. N
966968
the caller is responsible to notify the workers about the new job.
967969
968970
=cut
971+
969972
sub auto_duplicate ($self, $args = {}) {
970973
my $clones = $self->duplicate($args);
971974
return $clones unless ref $clones eq 'HASH';
@@ -1694,6 +1697,7 @@ sub _failure_reason ($self) {
16941697
Returns the hook script for this job depending on its result and settings and the global configuration.
16951698
16961699
=cut
1700+
16971701
sub hook_script ($self) {
16981702
my $trigger_hook = $self->settings_hash->{_TRIGGER_JOB_DONE_HOOK};
16991703
return undef if defined $trigger_hook && !$trigger_hook;
@@ -1753,6 +1757,7 @@ carry over bugrefs (i.e. special comments) from previous jobs to current
17531757
result in the same scenario.
17541758
17551759
=cut
1760+
17561761
sub carry_over_bugrefs ($self) {
17571762
try {
17581763
if (my $group = $self->group) { return undef unless $group->carry_over_bugrefs }
@@ -2109,6 +2114,7 @@ if result is not set (expected default situation) result is computed from the re
21092114
test modules
21102115
21112116
=cut
2117+
21122118
sub done ($self, %args) {
21132119
# read specified result or calculate result from module results if none specified
21142120
my $result;

0 commit comments

Comments
 (0)