| 1 | package App::Workflow::Lint::Rule::DeprecatedSetEnv; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use Carp qw(croak carp); | ||
| 6 | use parent 'App::Workflow::Lint::Rule'; | ||
| 7 | |||
| 8 | sub id { 'deprecated-set-env' } | ||
| 9 | sub description { 'The ::set-env command is deprecated and insecure' } | ||
| 10 | sub applies_to { 'step' } | ||
| 11 | sub level { 'error' } | ||
| 12 | |||
| 13 | sub check_step { | ||
| 14 | my ($self, $step, $ctx) = @_; | ||
| 15 | |||
| 16 | return () unless exists $step->{run}; | ||
| 17 | |||
| 18 | my $run = $step->{run}; | ||
| 19 | |||
| 20 | return () unless $run =~ /::set-env/; | ||
| 21 | |||
| 22 | return $self->diag( | ||
| 23 | message => "Deprecated ::set-env command used", | ||
| 24 | path => "/jobs/$ctx->{job_name}/steps/$ctx->{step_index}", | ||
| 25 | file => $ctx->{file}, | ||
| 26 | ); | ||
| 27 | } | ||
| 28 | |||
| 29 | 1; | ||
| 30 |