diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/lint.py b/lint-workflow-v2/src/bitwarden_workflow_linter/lint.py index 1a56fd37..242f6c8b 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/lint.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/lint.py @@ -104,9 +104,10 @@ def lint_file(self, filename: str) -> int: for rule in self.rules.job: findings.append(rule.execute(job)) - for step in job.steps: - for rule in self.rules.step: - findings.append(rule.execute(step)) + if job.steps is not None: + for step in job.steps: + for rule in self.rules.step: + findings.append(rule.execute(step)) findings = list(filter(lambda a: a is not None, findings)) diff --git a/lint-workflow-v2/tests/rules/test_pinned_job_runner.py b/lint-workflow-v2/tests/rules/test_pinned_job_runner.py index 07a8a208..9f23024c 100644 --- a/lint-workflow-v2/tests/rules/test_pinned_job_runner.py +++ b/lint-workflow-v2/tests/rules/test_pinned_job_runner.py @@ -59,6 +59,7 @@ def test_rule_on_correct_runner(rule, correct_runner): result, _ = rule.fn(correct_runner.jobs["call-workflow"]) assert result is True + def test_rule_on_incorrect_runner(rule, incorrect_runner): result, _ = rule.fn(incorrect_runner.jobs["job-key"]) assert result is False