Koha-QA

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "ExtUtils::MakeMaker" : "6.52",
            "File::ShareDir::Install" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "File::ShareDir" : "0",
            "File::Slurp" : "0",
            "File::Temp" : "0",
            "IPC::Run3" : "0",
            "Modern::Perl" : "0",
            "Perl::Critic" : "0",
            "Perl::Tidy" : "== 20250105",
            "Pod::Checker" : "0",
            "perl" : "5.016000"
         }
      },
      "test" : {
         "requires" : {
            "Test::More" : "0",
            "Test::NoWarnings" : "0",

META.yml  view on Meta::CPAN

name: Koha-QA
no_index:
  directory:
    - t
    - inc
requires:
  File::ShareDir: '0'
  File::Slurp: '0'
  File::Temp: '0'
  IPC::Run3: '0'
  Modern::Perl: '0'
  Perl::Critic: '0'
  Perl::Tidy: '== 20250105'
  Pod::Checker: '0'
  perl: '5.016000'
resources:
  bugtracker: https://gitlab.com/joubu/koha-qa/-/issues
  repository: https://gitlab.com/joubu/koha-qa.git
version: v0.1.4
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

cpanfile  view on Meta::CPAN

requires 'Modern::Perl';
requires 'File::Temp';
requires 'File::Slurp';
requires 'File::ShareDir';
requires 'IPC::Run3';
requires 'Perl::Tidy', '== 20250105';
requires 'Perl::Critic';
requires 'Pod::Checker';

on 'test' => sub {
    requires 'Test::More';

lib/Koha/QA.pm  view on Meta::CPAN

package Koha::QA;

use Modern::Perl;

our $VERSION = '0.1.4';

=head1 NAME

Koha::QA - Quality Assurance utilities for Koha

=head1 SYNOPSIS

    use Koha::QA;

lib/Koha/QA/Base.pm  view on Meta::CPAN

package Koha::QA::Base;

use Modern::Perl;
use File::Slurp qw(read_file);
use File::Temp  qw(tempfile);

=head1 NAME

Koha::QA::Base - Base class for Koha QA modules

=head1 SYNOPSIS

  use base 'Koha::QA::Base';

lib/Koha/QA/FilePermissions.pm  view on Meta::CPAN

package Koha::QA::FilePermissions;

use Modern::Perl;
use base 'Koha::QA::Base';

=head1 NAME

Koha::QA::FilePermissions - Centralized file permissions checking

=head1 SYNOPSIS

  use Koha::QA::FilePermissions;

lib/Koha/QA/PerlCritic.pm  view on Meta::CPAN

package Koha::QA::PerlCritic;

use Modern::Perl;
use base 'Koha::QA::Base';
use File::ShareDir qw(dist_file);

=head1 NAME

Koha::QA::PerlCritic - Centralized Perl criticism checking using Perl::Critic

=head1 SYNOPSIS

  use Koha::QA::Critic::Perl;

lib/Koha/QA/PerlSyntax.pm  view on Meta::CPAN

package Koha::QA::PerlSyntax;

use Modern::Perl;
use base 'Koha::QA::Base';

=head1 NAME

Koha::QA::PerlSyntax - Centralized Perl syntax checking

=head1 SYNOPSIS

  use Koha::QA::PerlSyntax;

lib/Koha/QA/PodChecker.pm  view on Meta::CPAN

package Koha::QA::PodChecker;

use Modern::Perl;
use base 'Koha::QA::Base';

use Pod::Checker;

=head1 NAME

Koha::QA::PodChecker - Centralized POD checking

=head1 SYNOPSIS

lib/Koha/QA/Security.pm  view on Meta::CPAN

package Koha::QA::Security;

use Modern::Perl;

=head1 NAME

Koha::QA::Security - Security-related QA checks for Koha

=head1 SYNOPSIS

  use Koha::QA::Security;

=head1 DESCRIPTION

lib/Koha/QA/Security/CSRF.pm  view on Meta::CPAN

package Koha::QA::Security::CSRF;

use Modern::Perl;
use base 'Koha::QA::Base';

=head1 NAME

Koha::QA::Security::CSRF - Check for missing CSRF tokens and op parameters in forms

=head1 SYNOPSIS

  use Koha::QA::Security::CSRF;

lib/Koha/QA/Security/Nonce.pm  view on Meta::CPAN

package Koha::QA::Security::Nonce;

use Modern::Perl;
use base 'Koha::QA::Base';

=head1 NAME

Koha::QA::Security::Nonce - Check for missing nonce attributes in script/link tags

=head1 SYNOPSIS

  use Koha::QA::Security::Nonce;

lib/Koha/QA/Security/TemplateFilters.pm  view on Meta::CPAN

package Koha::QA::Security::TemplateFilters;

use Modern::Perl;
use base 'Koha::QA::Base';

=head1 NAME

Koha::QA::Security::TemplateFilters - Detect and fix missing filters in Template Toolkit files

=head1 SYNOPSIS

  use Koha::QA::Security::TemplateFilters;

lib/Koha/QA/Spelling.pm  view on Meta::CPAN

package Koha::QA::Spelling;

use Modern::Perl;
use base 'Koha::QA::Base';

=head1 NAME

Koha::QA::Spelling - Centralized spell checking using codespell

=head1 SYNOPSIS

  use Koha::QA::Spelling;

lib/Koha/QA/TestNoWarnings.pm  view on Meta::CPAN

package Koha::QA::TestNoWarnings;

use Modern::Perl;
use base 'Koha::QA::Base';

=head1 NAME

Koha::QA::TestNoWarnings - Centralized Test::NoWarnings checking

=head1 SYNOPSIS

  use Koha::QA::TestNoWarnings;

lib/Koha/QA/Tidy.pm  view on Meta::CPAN

package Koha::QA::Tidy;

use Modern::Perl;

=head1 NAME

Koha::QA::Tidy - Code tidiness QA checks for Koha

=head1 SYNOPSIS

  use Koha::QA::Tidy;

=head1 DESCRIPTION

lib/Koha/QA/Tidy/JS.pm  view on Meta::CPAN

package Koha::QA::Tidy::JS;

use Modern::Perl;
use base 'Koha::QA::Base';
use File::ShareDir qw(dist_file dist_dir);
use File::Spec;
use IPC::Run3;

=head1 NAME

Koha::QA::Tidy::JS - Centralized JavaScript/TypeScript tidiness checking using prettier

=head1 SYNOPSIS

lib/Koha/QA/Tidy/Perl.pm  view on Meta::CPAN

package Koha::QA::Tidy::Perl;

use Modern::Perl;
use base 'Koha::QA::Base';
use File::ShareDir qw(dist_file);

=head1 NAME

Koha::QA::Tidy::Perl - Centralized Perl tidiness checking using perltidy

=head1 SYNOPSIS

  use Koha::QA::Tidy::Perl;

lib/Koha/QA/Tidy/TT.pm  view on Meta::CPAN

package Koha::QA::Tidy::TT;

use Modern::Perl;
use base 'Koha::QA::Base';
use File::ShareDir qw(dist_file dist_dir);
use File::Slurp    qw(read_file write_file);
use File::Spec;
use IPC::Run3;

=head1 NAME

Koha::QA::Tidy::TT - Centralized Template Toolkit tidiness checking using prettier

share/perlcriticrc  view on Meta::CPAN

severity = 5
include = ProhibitUnusedVariables Objects::ProhibitIndirectSyntax
exclude = Miscellanea::RequireRcsKeywords

[Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval]
allow_includes =1

[TestingAndDebugging::RequireUseStrict]
equivalent_modules = Modern::Perl

[TestingAndDebugging::RequireUseWarnings]
equivalent_modules = Modern::Perl

[-Modules::RequireBarewordIncludes]

t/00-load.t  view on Meta::CPAN

use Modern::Perl;
use Test::More;

BEGIN {
    # Namespace modules
    use_ok('Koha::QA');
    use_ok('Koha::QA::Base');
    use_ok('Koha::QA::Security');
    use_ok('Koha::QA::Tidy');

    # Security modules

t/file_permissions.t  view on Meta::CPAN

use Modern::Perl;

use Test::More tests => 5;
use Test::NoWarnings;
use File::Temp qw(tempfile);
use Koha::QA::FilePermissions;

my $expected_messages = {};

sub check_permissions {
    my ( $file, $params ) = @_;

t/file_permissions.t  view on Meta::CPAN

            }
        ],
        '.t file without exec flag fails'
    );
};

subtest 'File .pm has exec flag' => sub {
    plan tests => 1;

    my ( $fh, $filename ) = tempfile( UNLINK => 0, TEMPDIR => 1, SUFFIX => '.pm' );
    print $fh "use Modern::Perl;\n1;";
    close $fh;
    chmod 0755, $filename or die "chmod failed: $!";

    my @errors = check_permissions($filename);
    is_deeply(
        \@errors,
        [
            {
                error   => 'extra_x_flag',
                message => 'File must not have the exec flag',
            }
        ],
        '.pm file with exec flag fails'
    );
};

subtest 'File .pm does not have exec flag' => sub {
    plan tests => 1;

    my ( $fh, $filename ) = tempfile( UNLINK => 0, TEMPDIR => 1, SUFFIX => '.pm' );
    print $fh "use Modern::Perl;\n1;";
    close $fh;
    chmod 0644, $filename or die "chmod failed: $!";

    my @errors = check_permissions($filename);
    is( scalar @errors, 0, '.pm file without exec flag passes' );
};

t/perl_syntax.t  view on Meta::CPAN

use Modern::Perl;

use Test::More tests => 7;
use Test::NoWarnings;
use File::Temp qw(tempfile);
use Koha::QA::PerlSyntax;

my $expected_messages = {};

sub check_syntax {
    my ( $content, $params ) = @_;

t/perlcritic.t  view on Meta::CPAN

use Modern::Perl;

use Test::NoWarnings;
use Test::More tests => 5;
use File::Temp qw(tempfile);
use Koha::QA::PerlCritic;

my $expected_messages = {};

sub check_critic {
    my ( $content, $params ) = @_;

t/pod_checker.t  view on Meta::CPAN

use Modern::Perl;

use Test::More tests => 4;
use Test::NoWarnings;
use File::Temp qw(tempfile);
use Koha::QA::PodChecker;

my $expected_messages = {};

sub check_pod {
    my ( $content, $params ) = @_;

t/security/csrf.t  view on Meta::CPAN

use Modern::Perl;
use Test::NoWarnings;
use Test::More tests => 11;
use File::Temp qw(tempfile);
use Koha::QA::Security::CSRF;

my $expected_messages = {
    missing_csrf_token => q{Some forms with POST method are missing CSRF token (bug 22990)},
    missing_op         => q{Form with POST method is missing op parameter (see bug 34478)},
    invalid_op_value   => q{op parameter value should start with "cud-" or be a TT variable (see bug 34478)},
};

t/security/nonce.t  view on Meta::CPAN

use Modern::Perl;
use Test::More;

use Koha::QA::Security::Nonce;

my $expected_messages = {
    missing_nonce => q{<script> or <style> tag does not have 'nonce' attribute (see bug 38365)},
};

subtest 'Template script with src' => sub {
    plan tests => 2;

t/security/template_filters.t  view on Meta::CPAN

use Modern::Perl;

use Test::NoWarnings;
use Test::More tests => 9;
use File::Temp qw(tempfile);
use Koha::QA::Security::TemplateFilters;

my $expected_messages = {
    asset_must_be_raw       => q{The Asset Template::Toolkit plugin must be escaped using the $raw filter},
    missing_filter          => q{Missing filter, the variable is not escaped and might cause XSS vulnerabilities},
    wrong_html_filter       => q{Wrong html filter, uri or url must be used instead of html},

t/spelling.t  view on Meta::CPAN

use Modern::Perl;

use IPC::Run3;

BEGIN {
    # Check if codespell is available
    my ( $stdout, $stderr );
    eval { run3( [ 'codespell', '--version' ], undef, \$stdout, \$stderr ) };
    if ( $@ || $? != 0 ) {
        print "1..0 # skip codespell is not available\n";
        exit 0;

t/tidy/js.t  view on Meta::CPAN

use Modern::Perl;

use File::ShareDir qw(dist_file dist_dir);
use File::Spec;
use IPC::Run3;

use Koha::QA::Tidy::JS;

BEGIN {
    # Check if prettier is available via node
    my ( $stdout, $stderr );



( run in 3.021 seconds using v1.01-cache-2.11-cpan-eb134014566 )