Lint/Rule/MissingPermissions.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 29 CC 2 SCAR 11.0
CC
2
Cov
0%
check
6.0
id
2.0
description
2.0
CRAP 3.0
1 package App::Workflow::Lint::Rule::MissingPermissions;
2  
3 use strict;
4 use warnings;
5 use Carp qw(croak carp);
6 use parent 'App::Workflow::Lint::Rule';
7  
8 sub id { 'missing-permissions' }
9 sub description { 'Workflow should define a top-level permissions block' }
10  
11 #----------------------------------------------------------------------
12 # check($workflow, $ctx)
13 #
14 # Returns a diagnostic hashref if the workflow lacks a permissions block.
15 #----------------------------------------------------------------------
16 sub check {
17 my ($self, $wf, $ctx) = @_;
18  
19 return () if exists $wf->{permissions};
20  
21 return {
22 rule => $self->id,
23 level => 'warning',
24 message => 'Workflow is missing a top-level permissions block',
25 path => '/',
26 file => $ctx->{file},
27 };
28 }
29  
30 1;
31