Skip to content

Commit

Permalink
apply black
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeebru committed Jan 6, 2025
1 parent 06a20db commit dc83955
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/bitwarden_workflow_linter/rules/run_actionlint.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ def __init__(self, settings: Optional[Settings] = None) -> None:

def fn(self, obj: Workflow) -> Tuple[bool, str]:
if not obj.filename:
raise NotImplementedError("Running actionlint without a filename is not currently supported")
raise NotImplementedError(
"Running actionlint without a filename is not currently supported"
)
installed, install_error = check_actionlint()
if installed:
result = subprocess.run(
["actionlint", obj.filename],
capture_output=True,
text=True,
check=False,
)
if result.returncode == 1:
print(result.stdout)
Expand Down
8 changes: 6 additions & 2 deletions tests/rules/test_run_actionlint.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@

yaml = YAML()


@pytest.fixture(name="rule")
def fixture_rule():
return RunActionlint()


def test_rule_on_correct_workflow(rule):
correct_workflow = WorkflowBuilder.build("tests/fixtures/test_workflow.yaml")
correct_workflow = WorkflowBuilder.build("tests/fixtures/test_workflow.yaml")
result, _ = rule.fn(correct_workflow)
assert result is True


def test_rule_on_incorrect_workflow(rule):
incorrect_workflow = WorkflowBuilder.build("tests/fixtures/test_workflow_incorrect.yaml")
incorrect_workflow = WorkflowBuilder.build(
"tests/fixtures/test_workflow_incorrect.yaml"
)
result, _ = rule.fn(incorrect_workflow)
assert result is False

0 comments on commit dc83955

Please sign in to comment.