Skip to content

Commit

Permalink
Merge pull request #282 from perlpunk/subrepo-update
Browse files Browse the repository at this point in the history
git-subrepo: update external/os-autoinst-common
  • Loading branch information
mergify[bot] authored Jan 18, 2024
2 parents b2d511a + 187430a commit 2fdfd08
Show file tree
Hide file tree
Showing 22 changed files with 494 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: 'Commit message check'

# yamllint disable-line rule:truthy
on:
workflow_call:
secrets:
accessToken:
required: true

jobs:
base-check-commit-message:
name: Check commit message
runs-on: ubuntu-latest
steps:
- name: Check subject beginning
uses: gsactions/commit-message-checker@v2
with:
pattern: '^([A-Z]|\S+:|git subrepo pull)'
flags: 'g'
error: 'The subject does not start with a capital or tag.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.accessToken }}

- name: Check subject line length
uses: gsactions/commit-message-checker@v2
with:
pattern: '^.{1,72}(\n|$)'
flags: 'g'
error: 'The maximum subject line length of 72 characters is exceeded.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.accessToken }}

- name: Check subject ending
uses: gsactions/commit-message-checker@v2
with:
pattern: '^.+(?<!\.)(\n|$)'
flags: 'g'
error: 'The subject cannot not end with a dot.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.accessToken }}

- name: Check empty line
uses: gsactions/commit-message-checker@v2
with:
pattern: '^.*(\n\n|$)'
flags: 'g'
error: 'No newline between title and description.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.accessToken }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: 'Commit message check'

# yamllint disable-line rule:truthy
on:
pull_request:
push:
branches:
# we must not fix commit messages when they already reached master
- '!master'

jobs:
check-commit-message:
secrets:
accessToken: "${{ secrets.GITHUB_TOKEN }}"
uses: ./.github/workflows/base-commit-message-checker.yml

This file was deleted.

19 changes: 19 additions & 0 deletions external/os-autoinst-common/.github/workflows/perl-critic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: 'Perl critic'

# yamllint disable-line rule:truthy
on:
pull_request:
push:
branches:
- 'master'

jobs:
perl-critic-checks:
runs-on: ubuntu-latest
name: "Perlcritic"
container:
image: perldocker/perl-tester
steps:
- uses: actions/checkout@v4
- run: ./tools/perlcritic --quiet .
19 changes: 19 additions & 0 deletions external/os-autoinst-common/.github/workflows/perl-lint-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: 'Perl static checks'

# yamllint disable-line rule:truthy
on:
pull_request:
push:
branches:
- 'master'

jobs:
perl-lint-checks:
runs-on: ubuntu-latest
name: "Perltidy"
container:
image: perldocker/perl-tester
steps:
- uses: actions/checkout@v4
- run: GITHUB_ACTIONS=1 ./tools/tidyall --check-only --all --quiet
1 change: 1 addition & 0 deletions external/os-autoinst-common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.tidyall.d/
6 changes: 3 additions & 3 deletions external/os-autoinst-common/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = [email protected]:os-autoinst/os-autoinst-common.git
branch = master
commit = a62482b1461da31d436e6ccaf838604ababe0b2c
parent = 5a9f2d23546689931d8ee90db08a95c6aa77fc6d
commit = 3d6106cb21f6320edc144297546cda0aaa155f01
parent = b2d511aaf0923896d37cb46c4a3190cee62c4319
method = merge
cmdver = 0.4.3
cmdver = 0.4.6
49 changes: 49 additions & 0 deletions external/os-autoinst-common/.perlcriticrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
theme = community + openqa
severity = 4
include = strict ValuesAndExpressions::ProhibitInterpolationOfLiterals

verbose = ::warning file=%f,line=%l,col=%c,title=%m - severity %s::[%p] %e\n

# == Perlcritic Policies
# -- Test::Most brings in strict & warnings
[TestingAndDebugging::RequireUseStrict]
equivalent_modules = Test::Most

[TestingAndDebugging::RequireUseWarnings]
equivalent_modules = Test::Most

# -- Avoid double quotes unless there's interpolation or a single quote.
[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
allow_if_string_contains_single_quote = 1
severity = 3

# -- Prohibit deep nesting
[ControlStructures::ProhibitDeepNests]
severity = 4
add_themes = community
max_nests = 4

# == Community Policies
# -- Test::Most brings in strict & warnings
[Freenode::StrictWarnings]
extra_importers = Test::Most

# -- Test::Most brings in strict & warnings
[Community::StrictWarnings]
extra_importers = Test::Most

[Community::DiscouragedModules]
severity = 3

# Test modules have no package declaration
[Community::PackageMatchesFilename]
severity = 1

# == Custom Policies
# -- Useless quotes on hashes
[HashKeyQuotes]
severity = 5

# -- Superfluous use strict/warning.
[RedundantStrictWarning]
equivalent_modules = Test::Most
14 changes: 14 additions & 0 deletions external/os-autoinst-common/.perltidyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Workaround needed for handling non-ASCII in files.
# # See <https://github.com/houseabsolute/perl-code-tidyall/issues/84>.
--character-encoding=none
--no-valign
-l=160
-fbl # don't change blank lines
-fnl # don't remove new lines
-nsfs # no spaces before semicolons
-baao # space after operators
-bbao # space before operators
-pt=2 # no spaces around ()
-bt=2 # no spaces around []
-sbt=2 # no spaces around {}
-sct # stack closing tokens )}
3 changes: 3 additions & 0 deletions external/os-autoinst-common/.tidyallrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[PerlTidy]
select = **/*.{pl,pm,t} tools/tidyall tools/perlcritic tools/update-deps
argv = --profile=$ROOT/.perltidyrc
2 changes: 0 additions & 2 deletions external/os-autoinst-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ This repository is to be used as a

[![Packaging status](https://repology.org/badge/vertical-allrepos/git-subrepo.svg)](https://repology.org/project/git-subrepo/versions)

and in `devel:openQA`, e.g. https://download.opensuse.org/repositories/devel:/openQA:/Leap:/15.2/openSUSE_Leap_15.2/

## Usage

### Clone
Expand Down
26 changes: 26 additions & 0 deletions external/os-autoinst-common/cpanfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
##################################################
# WARNING
# This file is autogenerated by tools/update-deps
# from dependencies.yaml
##################################################

requires 'Module::CPANfile';
requires 'Storable', '>= 3.06';

on 'test' => sub {
requires 'Test::Most';
requires 'Test::Warnings';

};

on 'develop' => sub {
requires 'Code::TidyAll';
requires 'Perl::Critic';
requires 'Perl::Critic::Community';
requires 'Perl::Tidy', '== 20230912';

};

feature 'coverage', 'coverage for CI' => sub {

};
32 changes: 32 additions & 0 deletions external/os-autoinst-common/dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# % is placeholder for section.
# e.g.:
# % => develop
# %_requires => develop_requires
targets:
# List all %_requires into a cpanfile
cpanfile: [main, develop, test]
cpanfile-targets:
# save %_require into cpanfile section
develop: develop
test: test

main_requires:
# Needed until preaction/Log-Any#105 is solved.
perl(Storable): '>= 3.06'
perl(Module::CPANfile):
perl(version):

develop_requires:
perl(Perl::Tidy): '== 20230912'
perl(Code::TidyAll):
perl(Perl::Critic):
perl(Perl::Critic::Community):

cover_requires:
perl(Devel::Cover):
perl(Devel::Cover::Report::Codecov):

test_requires:
perl(Test::Most):
perl(Test::Warnings):
5 changes: 3 additions & 2 deletions external/os-autoinst-common/lib/OpenQA/Test/PatchDeparse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ if (
)
{

#<<< do not let perltidy touch this
#<<< do not let perltidy nor perlcritic touch this
## no critic (TestingAndDebugging::ProhibitNoStrict ValuesAndExpressions::ProhibitInterpolationOfLiterals)
# This is not our code, and formatting should stay the same for
# better comparison with new versions of B::Deparse
# <---- PATCH
Expand Down Expand Up @@ -60,7 +61,7 @@ elsif ($B::Deparse::VERSION) {
diag
"Using B::Deparse v$B::Deparse::VERSION. If you see 'uninitialized' warnings, update patch in t/lib/OpenQA/Test/PatchDeparse.pm";
}

## use critic
1;


6 changes: 3 additions & 3 deletions external/os-autoinst-common/lib/OpenQA/Test/TimeLimit.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
package OpenQA::Test::TimeLimit;
use Test::Most;

my $SCALE_FACTOR = 1;
my $SCALE_FACTOR = $ENV{OPENQA_TEST_TIMEOUT_SCALE_FACTOR} // 1;

sub import {
my ($package, $limit) = @_;
die "$package: Need argument on import, e.g. use: use OpenQA::Test::TimeLimit '42';" unless $limit;
# disable timeout if requested by ENV variable or running within debugger
return if ($ENV{OPENQA_TEST_TIMEOUT_DISABLE} or $INC{'perl5db.pl'});
$SCALE_FACTOR *= $ENV{OPENQA_TEST_TIMEOUT_SCALE_COVER} // 3 if Devel::Cover->can('report');
$SCALE_FACTOR *= $ENV{OPENQA_TEST_TIMEOUT_SCALE_CI} // 2 if $ENV{CI};
$limit *= $SCALE_FACTOR;
$SCALE_FACTOR *= $ENV{OPENQA_TEST_TIMEOUT_SCALE_CI} // 2 if $ENV{CI};
$limit *= $SCALE_FACTOR;
$SIG{ALRM} = sub { BAIL_OUT "test '$0' exceeds runtime limit of '$limit' seconds\n" };
alarm $limit;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright SUSE LLC
# SPDX-License-Identifier: GPL-2.0-or-later

package Perl::Critic::Policy::ArgumentInUseStrictWarnings;

use strict;
use warnings;
use experimental 'signatures';
use base 'Perl::Critic::Policy';

use Perl::Critic::Utils qw( :severities :classification :ppi );

our $VERSION = '0.0.1';

sub default_severity { return $SEVERITY_HIGH }
sub default_themes { return qw(openqa) }
sub applies_to { return qw(PPI::Statement::Include) }

my $desc = q{use strict/warnings with arguments};
my $expl = q{Remove argument from: %s.};

# check that use use strict and warnings don't have arguments.
sub violates ($self, $elem, $document) {
# skip if it's not a use
return unless $elem->type() eq 'use';
# skip if it's not a pragma
return unless my $pragma = $elem->pragma();
# skip if it's not warnings or strict
return unless ($pragma eq 'warnings' || $pragma eq 'strict');

my @args = $elem->arguments();
# skip if it doesn't have arguments
return if scalar(@args) == 0;

# allow promoting warnings to FATAL
return if scalar(grep { $_->content eq 'FATAL' } @args);

# Report the problem.
return $self->violation($desc, sprintf($expl, $elem), $elem);
}

1;
Loading

0 comments on commit 2fdfd08

Please sign in to comment.