Skip to content

Commit

Permalink
Allow configurable SPDX check exclusions
Browse files Browse the repository at this point in the history
@SPDX_IGNORE may now be set in the perl.conf test configuration file
to specify an additional list of regular expressions matching files
that the check for SPDX license headers should ignore.
  • Loading branch information
rra committed Dec 31, 2023
1 parent 62f37d8 commit 6a3da8c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ rra-c-util 10.5 (unreleased)
add several new GCC warnings and related flags added between GCC 9.2
and 13.2.

@SPDX_IGNORE may now be set in the perl.conf test configuration file
to specify an additional list of regular expressions matching files
that the check for SPDX license headers should ignore.

Ignore files created by the Perl Carton tool, JSON files, and
temporary files generated by tests when checking for SPDX licenses and
Perl strictness in standard tests.
Expand Down
2 changes: 2 additions & 0 deletions perl/t/docs/spdx-license.t
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ use warnings;
use lib 't/lib';

use Test::RRA qw(skip_unless_automated);
use Test::RRA::Config qw(@SPDX_IGNORE);

use File::Find qw(find);
use Test::More;
Expand All @@ -60,6 +61,7 @@ my @IGNORE = (
qr{ ~ \z }xms, # Backup files
);
my @IGNORE_PATHS = (
@SPDX_IGNORE,
qr{ \A [.] / [.] git/ }xms, # Version control files
qr{ \A [.] / [.] pc/ }xms, # quilt metadata files
qr{ \A [.] /_build/ }xms, # Module::Build metadata
Expand Down
2 changes: 2 additions & 0 deletions tests/data/perl.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Configuration for Perl tests. -*- perl -*-
#
# See the documentation for Test::RRA::Config for all available options.

# Ignore these top-level directories for perlcritic testing.
@CRITIC_IGNORE = qw();
Expand Down
2 changes: 2 additions & 0 deletions tests/docs/spdx-license-t
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use lib "$ENV{C_TAP_SOURCE}/tap/perl";

use Test::RRA qw(skip_unless_automated);
use Test::RRA::Automake qw(all_files automake_setup);
use Test::RRA::Config qw(@SPDX_IGNORE);

use File::Basename qw(basename);
use Test::More;
Expand All @@ -58,6 +59,7 @@ my @IGNORE = (
qr{ [.] output \z }xms, # Test data
);
my @IGNORE_PATHS = (
@SPDX_IGNORE,
qr{ \A debian/ }xms, # Found in debian/* branches
qr{ \A docs/metadata/ }xms, # Package license should be fine
qr{ \A docs/protocol[.](html|txt) \z }xms, # Generated by xml2rfc
Expand Down
13 changes: 10 additions & 3 deletions tests/tap/perl/Test/RRA/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ BEGIN {
@EXPORT_OK = qw(
$COVERAGE_LEVEL @COVERAGE_SKIP_TESTS @CRITIC_IGNORE $LIBRARY_PATH
$MINIMUM_VERSION %MINIMUM_VERSION @MODULE_VERSION_IGNORE
@POD_COVERAGE_EXCLUDE @STRICT_IGNORE @STRICT_PREREQ
@POD_COVERAGE_EXCLUDE @SPDX_IGNORE @STRICT_IGNORE @STRICT_PREREQ
);

# This version should match the corresponding rra-c-util release, but with
Expand Down Expand Up @@ -62,6 +62,7 @@ our $MINIMUM_VERSION = '5.010';
our %MINIMUM_VERSION;
our @MODULE_VERSION_IGNORE;
our @POD_COVERAGE_EXCLUDE;
our @SPDX_IGNORE;
our @STRICT_IGNORE;
our @STRICT_PREREQ;

Expand All @@ -76,7 +77,7 @@ __END__
=for stopwords
Allbery rra-c-util Automake perlcritic .libs namespace subdirectory sublicense
MERCHANTABILITY NONINFRINGEMENT regexes
MERCHANTABILITY NONINFRINGEMENT regexes SPDX
=head1 NAME
Expand Down Expand Up @@ -159,6 +160,12 @@ testing. Normally, all methods have to be documented in the POD for a Perl
module, but methods matching any of these regexes will be considered private
and won't require documentation.
=item @SPDX_IGNORE
Regexes that match files that should be excluded from SPDX license header
checks, in addition to the standard exclusions. The regular expression is
matched against the file path relative to the top of the source tree.
=item @STRICT_IGNORE
Additional directories to ignore when doing recursive Test::Strict testing for
Expand All @@ -183,7 +190,7 @@ Russ Allbery <[email protected]>
=head1 COPYRIGHT AND LICENSE
Copyright 2015-2016, 2019, 2021 Russ Allbery <[email protected]>
Copyright 2015-2016, 2019, 2021, 2023 Russ Allbery <[email protected]>
Copyright 2013-2014 The Board of Trustees of the Leland Stanford Junior
University
Expand Down

0 comments on commit 6a3da8c

Please sign in to comment.