Browse files

Return detailed result for scriptability

  • Loading branch information...
1 parent 1e53a6e commit 058bed59288dc5e57469b49f5aced950d21893f1 Steven Haryanto (on Asus Zenbook) committed Aug 28, 2012
Showing with 10 additions and 15 deletions.
  1. +1 −1 dist.ini
  2. +9 −14 lib/App/LintPrereqs.pm
View
2 dist.ini
@@ -22,7 +22,7 @@ Sort::Versions=0
Perl::PrereqScanner=0
;cli script
-Perinci::CmdLine=0
+Perinci::CmdLine=0.62
[Extras / lint-prereqs / assume-used]
; required via cmdline
View
23 lib/App/LintPrereqs.pm
@@ -134,21 +134,19 @@ sub lint_prereqs {
$core_mods{$1} = $2 // 0;
}
- my $err;
-
+ my @errs;
for my $mod (keys %mods_from_ini) {
next if $mod eq 'perl';
$log->tracef("Checking mod from dist.ini: %s", $mod);
if (exists($core_mods{$mod}) &&
versioncmp($core_mods{$mod}, $mods_from_ini{$mod}) >= 0) {
- $log->warnf("Module is core, but mentioned in dist.ini: %s", $mod);
- $err++;
+ push @errs, {
+ module=>$mod, message=>"Core but mentioned"};
}
unless (exists($mods_from_scanned{$mod}) ||
exists($assume_used{$mod})) {
- $log->warnf("Module doesn't seem to be used, ".
- "but mentioned in dist.ini: %s", $mod);
- $err++;
+ push @errs, {
+ module=>$mod, message=>"Unused but mentioned"};
}
}
@@ -159,16 +157,13 @@ sub lint_prereqs {
next if exists $pkgs{$mod};
unless (exists($mods_from_ini{$mod}) ||
exists($assume_provided{$mod})) {
- $log->errorf("Module is used, but not mentioned in dist.ini: %s",
- $mod);
- $err++;
+ push @errs, {
+ module=>$mod, message=>"Used but not mentioned"};
}
}
- $err ?
- [500, "Extraneous/missing dependencies", undef,
- {"cmdline.display_result"=>0}] :
- [200, "OK"];
+ [200, @errs ? "Extraneous/missing dependencies" : "OK", \@errs,
+ {"cmdline.exit_code" => @errs ? 1:0}];
}
1;

0 comments on commit 058bed5

Please sign in to comment.