Skip to content

Commit

Permalink
Fix the lint command to be compatible with callable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-flinn committed Feb 28, 2024
1 parent 2dc3cde commit 92a85c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lint-workflow-v2/src/bitwarden_workflow_linter/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
1 change: 1 addition & 0 deletions lint-workflow-v2/tests/rules/test_pinned_job_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 92a85c7

Please sign in to comment.