Skip to content

Commit

Permalink
Fix critique
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuelsmann committed Sep 30, 2023
1 parent 2c3e35f commit 361e7d7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/LedgerSMB/Database.pm
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ sub get_info {

if ($have_version_column) {
# Legacy SL and LSMB
$self->logger->trace( "Legacy SL or LSMB database" );
$self->logger->trace( 'Legacy SL or LSMB database' );
$sth = $dbh->prepare(
'SELECT version FROM defaults'
);
Expand Down Expand Up @@ -378,7 +378,7 @@ sub get_info {
$sth = $dbh->prepare('SELECT fldvalue FROM defaults WHERE fldname = ?');
$sth->execute('version');
if (my $ref = $sth->fetchrow_hashref('NAME_lc')){
$self->logger->trace( "SL" );
$self->logger->trace( 'SL' );
$retval->{appname} = 'sql-ledger';
$retval->{full_version} = $ref->{fldvalue};
$retval->{version} = $ref->{fldvalue};
Expand Down
4 changes: 2 additions & 2 deletions lib/LedgerSMB/Database/Loadorder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ sub scripts {
map { $self->_limit_by_tag($_) }
<$fh>;
close $fh or die "Cannot open file $self->{_path}";
$log->trace( "Considering schema patches: " . join(', ',
map { $_->path } @scripts) );
$log->tracef( 'Considering schema patches: %s',
join(', ', map { $_->path } @scripts) );
$self->{_scripts} = \@scripts;
return @scripts;
}
Expand Down
19 changes: 12 additions & 7 deletions lib/LedgerSMB/Scripts/setup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use Digest::MD5 qw(md5_hex);
use Encode;
use File::Spec;
use HTML::Escape;
use HTTP::Status qw( HTTP_OK HTTP_UNAUTHORIZED );
use HTTP::Status qw( HTTP_OK HTTP_INTERNAL_SERVER_ERROR HTTP_UNAUTHORIZED );
use Log::Any;
use MIME::Base64;
use Scope::Guard;
Expand Down Expand Up @@ -725,12 +725,17 @@ sub _process_and_run_upgrade_script {
}
catch ($e) {
my $error_text = escape_html( $e );
local $/;
open my $out, '<:encoding(UTF-8)', $upgrade->logfiles->{out};
open my $err, '<:encoding(UTF-8)', $upgrade->logfiles->{err};
my $stdout = escape_html( <$out> );
my $stderr = escape_html( <$err> );
return [ 500,
local $/ = undef;
my $stdout = do {
open( my $out, '<:encoding(UTF-8)', $upgrade->logfiles->{out} )
and escape_html( <$out> )
};

my $stderr = do {
open( my $err, '<:encoding(UTF-8)', $upgrade->logfiles->{err} )
and escape_html( <$err> )
};
return [ HTTP_INTERNAL_SERVER_ERROR,
[ 'Content-Type' => 'text/html; charset=UTF-8' ],
[ "<html><body><h1>Error!</h1><p><b>$error_text</b></p><h3>STDERR</h3><pre style='max-height:30em;overflow:scroll'>$stderr</pre><h3>STDOUT</h3><pre style='max-height:30em;overflow:scroll'>$stdout</pre></body></html>" ] ];
};

Check failure on line 741 in lib/LedgerSMB/Scripts/setup.pm

View workflow job for this annotation

GitHub Actions / build-perl-env (5.32)

Error while loading /home/runner/work/LedgerSMB/LedgerSMB/bin/ledgersmb-server.psgi: parse failed--compilation aborted

Check failure on line 741 in lib/LedgerSMB/Scripts/setup.pm

View workflow job for this annotation

GitHub Actions / build-perl-env (5.34)

Error while loading /home/runner/work/LedgerSMB/LedgerSMB/bin/ledgersmb-server.psgi: parse failed--compilation aborted

Check failure on line 741 in lib/LedgerSMB/Scripts/setup.pm

View workflow job for this annotation

GitHub Actions / test-database (15, 5.34, 5)

Error while loading /home/runner/work/LedgerSMB/LedgerSMB/bin/ledgersmb-server.psgi: parse failed--compilation aborted

Check failure on line 741 in lib/LedgerSMB/Scripts/setup.pm

View workflow job for this annotation

GitHub Actions / test-pure-perl (5.32, 5)

Error while loading /home/runner/work/LedgerSMB/LedgerSMB/bin/ledgersmb-server.psgi: parse failed--compilation aborted

Check failure on line 741 in lib/LedgerSMB/Scripts/setup.pm

View workflow job for this annotation

GitHub Actions / test-pure-perl (5.32, 5)

[ FAIL ] job 1 + parse failed--compilation aborted

Check failure on line 741 in lib/LedgerSMB/Scripts/setup.pm

View workflow job for this annotation

GitHub Actions / test-pure-perl (5.32, 5)

( DIAG ) job 1 | Failed test 'parse failed--compilation aborted

Check failure on line 741 in lib/LedgerSMB/Scripts/setup.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.32, 13, operablink, 1, 7)

Error while loading /home/runner/work/LedgerSMB/LedgerSMB/bin/ledgersmb-server.psgi: parse failed--compilation aborted

Check failure on line 741 in lib/LedgerSMB/Scripts/setup.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.32, 15, firefox, 1, 7)

Error while loading /home/runner/work/LedgerSMB/LedgerSMB/bin/ledgersmb-server.psgi: parse failed--compilation aborted
Expand Down
2 changes: 1 addition & 1 deletion xt/01.1-critic.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sub test_files {
Perl::Critic::Violation::set_format( 'S%s %p %f: %l\n');

for my $file (@$files) {
tests critique => { async => (! $ENV{COVERAGE}) }, sub {
tests "critique for $file" => { async => (! $ENV{COVERAGE}) }, sub {
my @findings = map { "$_" } $critic->critique($file);

ok(scalar(@findings) == 0, "Critique for $file");

Check failure on line 28 in xt/01.1-critic.t

View workflow job for this annotation

GitHub Actions / test-pure-perl (5.32, 5)

( DIAG ) job 32 |
Expand Down

0 comments on commit 361e7d7

Please sign in to comment.