Koha-QA

 view release on metacpan or  search on metacpan

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;

  # With a file
  my $checker = Koha::QA::FilePermissions->new({file => $file});

  # Or with content directly
  my $checker = Koha::QA::FilePermissions->new({content => $content});

  my $is_valid = $checker->check;
  my @errors = $checker->errors;

=head1 DESCRIPTION

This module provides centralized file permissions checking.

=head1 METHODS

=head2 new

  my $checker = Koha::QA::FilePermissions->new({file => $file_path});

Creates a new FilePermissions instance.

=head2 check

  my $is_valid = $checker->check;

Checks if a file has correct executable permissions.

=head2 errors

  my @errors = $checker->errors;

Returns array of error hashrefs, each with:
  - error: the error type (missing_x_flag, extra_x_flag)

Rules:
  - Files in svc/, xt/ and .t files: must have exec flag
  - .pl and .sh files: must have exec flag
  - .pm files: must NOT have exec flag

=cut

use File::Basename;

sub check {
    my ($self) = @_;
    my $file = $self->file;

    my @errors;

    # Ignore files in .git, blib and node_modules



( run in 1.096 second using v1.01-cache-2.11-cpan-eb134014566 )