bitwarden_workflow_linter 0.12.8__tar.gz → 0.13.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/CODEOWNERS +1 -1
  2. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/renovate.json +1 -1
  3. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/ci.yml +2 -0
  4. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/PKG-INFO +1 -1
  5. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/__about__.py +1 -1
  6. bitwarden_workflow_linter-0.13.0/src/bitwarden_workflow_linter/actionlint_version.yaml +1 -0
  7. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/run_actionlint.py +8 -20
  8. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/utils.py +20 -1
  9. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/test_run_actionlint.py +20 -11
  10. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.editorconfig +0 -0
  11. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.gitattributes +0 -0
  12. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  13. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  14. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/_version_type.yml +0 -0
  15. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/actionlint_windows.yml +0 -0
  16. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/bwwl_operations.yml +0 -0
  17. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/cd.yml +0 -0
  18. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/enforce-labels.yml +0 -0
  19. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/examples/ci.yaml +0 -0
  20. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/examples/example-references/_build.yml +0 -0
  21. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/examples/example-references/_docker.yml +0 -0
  22. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/examples/example-references/_test.yml +0 -0
  23. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/examples/example-references/_version.yml +0 -0
  24. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/examples/example.yaml +0 -0
  25. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/examples/scan.yaml +0 -0
  26. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.github/workflows/scan.yml +0 -0
  27. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.gitignore +0 -0
  28. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.husky/pre-commit +0 -0
  29. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/.python-version +0 -0
  30. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/CONTRIBUTING.md +0 -0
  31. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/LICENSE.txt +0 -0
  32. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/Pipfile +0 -0
  33. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/Pipfile.lock +0 -0
  34. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/README.md +0 -0
  35. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/RULE_ROLLOUT.md +0 -0
  36. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/SECURITY.md +0 -0
  37. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/Taskfile.yml +0 -0
  38. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/actionlint_version.json +0 -0
  39. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/package-lock.json +0 -0
  40. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/package.json +0 -0
  41. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/pylintrc +0 -0
  42. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/pyproject.toml +0 -0
  43. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/pyproject.toml.tpl +0 -0
  44. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/settings.yaml +0 -0
  45. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/__init__.py +0 -0
  46. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/actions.py +0 -0
  47. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/cli.py +0 -0
  48. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/default_actions.json +0 -0
  49. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/default_settings.yaml +0 -0
  50. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/lint.py +0 -0
  51. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/load.py +0 -0
  52. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/models/__init__.py +0 -0
  53. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/models/job.py +0 -0
  54. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/models/step.py +0 -0
  55. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/models/workflow.py +0 -0
  56. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rule.py +0 -0
  57. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/__init__.py +0 -0
  58. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/check_pr_target.py +0 -0
  59. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/job_environment_prefix.py +0 -0
  60. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/name_capitalized.py +0 -0
  61. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/name_exists.py +0 -0
  62. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/permissions_exist.py +0 -0
  63. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/pinned_job_runner.py +0 -0
  64. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/step_approved.py +0 -0
  65. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/step_pinned.py +0 -0
  66. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/src/bitwarden_workflow_linter/rules/underscore_outputs.py +0 -0
  67. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/__init__.py +0 -0
  68. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/conftest.py +0 -0
  69. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/fixtures/test-alt.yml +0 -0
  70. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/fixtures/test-min-incorrect.yaml +0 -0
  71. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/fixtures/test-min.yaml +0 -0
  72. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/fixtures/test-outputs-incorrect.yml +0 -0
  73. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/fixtures/test.yml +0 -0
  74. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/fixtures/test_a.yaml +0 -0
  75. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/fixtures/test_workflow.yaml +0 -0
  76. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/fixtures/test_workflow_incorrect.yaml +0 -0
  77. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/__init__.py +0 -0
  78. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/test_check_pr_target.py +0 -0
  79. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/test_job_environment_prefix.py +0 -0
  80. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/test_name_capitalized.py +0 -0
  81. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/test_name_exists.py +0 -0
  82. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/test_permissions_exist.py +0 -0
  83. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/test_pinned_job_runner.py +0 -0
  84. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/test_step_approved.py +0 -0
  85. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/test_step_pinned.py +0 -0
  86. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/rules/test_underscore_output.py +0 -0
  87. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/test_job.py +0 -0
  88. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/test_lint.py +0 -0
  89. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/test_load.py +0 -0
  90. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/test_rule.py +0 -0
  91. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/test_step.py +0 -0
  92. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/test_utils.py +0 -0
  93. {bitwarden_workflow_linter-0.12.8 → bitwarden_workflow_linter-0.13.0}/tests/test_workflow.py +0 -0
@@ -9,5 +9,5 @@
9
9
 
10
10
  # AppSec owns default_actions and actionlint_version files
11
11
  src/bitwarden_workflow_linter/default_actions.json @bitwarden/team-appsec
12
- actionlint_version.json @bitwarden/team-appsec
12
+ src/bitwarden_workflow_linter/actionlint_version.yaml @bitwarden/team-appsec
13
13
 
@@ -23,7 +23,7 @@
23
23
  "customManagers": [
24
24
  {
25
25
  "customType": "regex",
26
- "fileMatch": ["^actionlint_version\\.json$"],
26
+ "fileMatch": ["^actionlint_version\\.yaml$"],
27
27
  "matchStrings": [
28
28
  "\"actionlint_version\":\\s*\"(?<currentValue>[^\"]+)\""
29
29
  ],
@@ -29,6 +29,8 @@ jobs:
29
29
  pipenv install --dev
30
30
 
31
31
  - name: Run pytest
32
+ env:
33
+ PYTHONPATH: "${{ github.workspace }}/src"
32
34
  run: pipenv run pytest tests --cov=src
33
35
 
34
36
  - name: Check type hinting
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitwarden_workflow_linter
3
- Version: 0.12.8
3
+ Version: 0.13.0
4
4
  Summary: Custom GitHub Action Workflow Linter
5
5
  Project-URL: Homepage, https://github.com/bitwarden/workflow-linter
6
6
  Project-URL: Issues, https://github.com/bitwarden/workflow-linter/issues
@@ -1,3 +1,3 @@
1
1
  """Metadata for Workflow Linter."""
2
2
 
3
- __version__ = "0.12.8"
3
+ __version__ = "0.13.0"
@@ -5,21 +5,20 @@ import subprocess
5
5
  import platform
6
6
  import urllib.request
7
7
  import os
8
- import json
9
8
 
10
9
  from ..rule import Rule
11
10
  from ..models.workflow import Workflow
12
11
  from ..utils import LintLevels, Settings
13
12
 
14
13
 
15
- def install_actionlint(platform_system: str) -> Tuple[bool, str]:
14
+ def install_actionlint(platform_system: str, version: str) -> Tuple[bool, str]:
16
15
  """If actionlint is not installed, detects OS platform
17
16
  and installs actionlint"""
18
17
 
19
18
  error = f"An error occurred when installing Actionlint on {platform_system}"
20
19
 
21
20
  if platform_system.startswith("Linux"):
22
- return install_actionlint_source(error)
21
+ return install_actionlint_source(error,version)
23
22
  elif platform_system == "Darwin":
24
23
  try:
25
24
  subprocess.run(["brew", "install", "actionlint"], check=True)
@@ -34,20 +33,8 @@ def install_actionlint(platform_system: str) -> Tuple[bool, str]:
34
33
  return False, f"{error} : check Choco installation"
35
34
  return False, error
36
35
 
37
- # temporarily commenting out this logic to allow time to troubleshoot it running in CI
38
- # def load_config() -> dict:
39
- # """Load configuration from a JSON file."""
40
- # config_path = os.path.join(os.path.dirname(__file__), "../../../actionlint_version.json")
41
- # if not os.path.exists(config_path):
42
- # raise FileNotFoundError(f"Configuration file not found: {config_path}")
43
- # with open(config_path, "r") as config_file:
44
- # return json.load(config_file)
45
-
46
- def install_actionlint_source(error) -> Tuple[bool, str]:
47
- #config = load_config()
48
- #if "actionlint_version" not in config:
49
- # raise KeyError("The 'actionlint_version' is missing in the configuration file.")
50
- version = "1.7.7"
36
+ def install_actionlint_source(error, version) -> Tuple[bool, str]:
37
+ version = version
51
38
  """Install Actionlint Binary from provided script"""
52
39
  url = "https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash"
53
40
  request = urllib.request.urlopen(url)
@@ -60,7 +47,7 @@ def install_actionlint_source(error) -> Tuple[bool, str]:
60
47
  return False, error
61
48
 
62
49
 
63
- def check_actionlint(platform_system: str) -> Tuple[bool, str]:
50
+ def check_actionlint(platform_system: str, version: str) -> Tuple[bool, str]:
64
51
  """Check if the actionlint is in the system's PATH."""
65
52
  try:
66
53
  subprocess.run(
@@ -77,7 +64,7 @@ def check_actionlint(platform_system: str) -> Tuple[bool, str]:
77
64
  please check your package installer or manually install it",
78
65
  )
79
66
  except FileNotFoundError:
80
- return install_actionlint(platform_system)
67
+ return install_actionlint(platform_system, version)
81
68
 
82
69
 
83
70
  class RunActionlint(Rule):
@@ -95,7 +82,8 @@ class RunActionlint(Rule):
95
82
  "Running actionlint without a filename is not currently supported"
96
83
  )
97
84
 
98
- installed, location = check_actionlint(platform.system())
85
+ """Check if Actionlint is alerady installed and if it is installed somewhere not on the PATH (location)"""
86
+ installed, location = check_actionlint(platform.system(), self.settings.actionlint_version)
99
87
  if installed:
100
88
  if location:
101
89
  result = subprocess.run(
@@ -107,17 +107,18 @@ class SettingsError(Exception):
107
107
 
108
108
  SettingsFromFactory = TypeVar("SettingsFromFactory", bound="Settings")
109
109
 
110
-
111
110
  class Settings:
112
111
  """Class that contains configuration-as-code for any portion of the app."""
113
112
 
114
113
  enabled_rules: list[dict[str, str]]
115
114
  approved_actions: dict[str, Action]
115
+ actionlint_version: str
116
116
 
117
117
  def __init__(
118
118
  self,
119
119
  enabled_rules: Optional[list[dict[str, str]]] = None,
120
120
  approved_actions: Optional[dict[str, dict[str, str]]] = None,
121
+ actionlint_version: Optional[str] = None,
121
122
  ) -> None:
122
123
  """Settings object that can be overridden in settings.py.
123
124
 
@@ -134,7 +135,11 @@ class Settings:
134
135
 
135
136
  if approved_actions is None:
136
137
  approved_actions = {}
138
+
139
+ if actionlint_version is None:
140
+ actionlint_version = ""
137
141
 
142
+ self.actionlint_version = actionlint_version
138
143
  self.enabled_rules = enabled_rules
139
144
  self.approved_actions = {
140
145
  name: Action(**action) for name, action in approved_actions.items()
@@ -142,6 +147,7 @@ class Settings:
142
147
 
143
148
  @staticmethod
144
149
  def factory() -> SettingsFromFactory:
150
+ # load default settings
145
151
  with (
146
152
  importlib.resources.files("bitwarden_workflow_linter")
147
153
  .joinpath("default_settings.yaml")
@@ -149,6 +155,16 @@ class Settings:
149
155
  ):
150
156
  settings = yaml.load(file)
151
157
 
158
+ # load actionlint version
159
+ with (
160
+ importlib.resources.files("bitwarden_workflow_linter")
161
+ .joinpath("actionlint_version.yaml")
162
+ .open("r", encoding="utf-8") as version_file
163
+ ):
164
+ version_data = yaml.load(version_file)
165
+ actionlint_version = version_data["actionlint_version"]
166
+
167
+ # load override settings
152
168
  settings_filename = "settings.yaml"
153
169
  local_settings = None
154
170
 
@@ -159,6 +175,7 @@ class Settings:
159
175
  if local_settings:
160
176
  settings.update(local_settings)
161
177
 
178
+ # load approved actions
162
179
  if settings["approved_actions_path"] == "default_actions.json":
163
180
  with (
164
181
  importlib.resources.files("bitwarden_workflow_linter")
@@ -172,7 +189,9 @@ class Settings:
172
189
  ) as action_file:
173
190
  settings["approved_actions"] = json.load(action_file)
174
191
 
192
+
175
193
  return Settings(
176
194
  enabled_rules=settings["enabled_rules"],
177
195
  approved_actions=settings["approved_actions"],
196
+ actionlint_version=actionlint_version,
178
197
  )
@@ -5,6 +5,7 @@ import subprocess
5
5
 
6
6
  from ruamel.yaml import YAML
7
7
 
8
+ from src.bitwarden_workflow_linter.utils import Settings
8
9
  from src.bitwarden_workflow_linter.load import WorkflowBuilder
9
10
  from src.bitwarden_workflow_linter.rules.run_actionlint import (
10
11
  RunActionlint,
@@ -14,7 +15,7 @@ from src.bitwarden_workflow_linter.rules.run_actionlint import (
14
15
  )
15
16
 
16
17
  yaml = YAML()
17
-
18
+ settings = Settings.factory()
18
19
 
19
20
  @pytest.fixture(name="rule")
20
21
  def fixture_rule():
@@ -22,12 +23,14 @@ def fixture_rule():
22
23
 
23
24
 
24
25
  def test_rule_on_correct_workflow(rule):
26
+ rule.settings = settings
25
27
  correct_workflow = WorkflowBuilder.build("tests/fixtures/test_workflow.yaml")
26
28
  result, _ = rule.fn(correct_workflow)
27
29
  assert result is True
28
30
 
29
31
 
30
32
  def test_rule_on_incorrect_workflow(rule):
33
+ rule.settings = settings
31
34
  incorrect_workflow = WorkflowBuilder.build(
32
35
  "tests/fixtures/test_workflow_incorrect.yaml"
33
36
  )
@@ -36,7 +39,7 @@ def test_rule_on_incorrect_workflow(rule):
36
39
 
37
40
 
38
41
  def test_pass_install_actionlint_linux():
39
- result, _ = install_actionlint("Linux")
42
+ result, _ = install_actionlint("Linux", settings.actionlint_version)
40
43
  assert result is True
41
44
 
42
45
 
@@ -45,7 +48,7 @@ def test_install_actionlint_darwin(monkeypatch):
45
48
  return subprocess.CompletedProcess(args, 0)
46
49
 
47
50
  monkeypatch.setattr(subprocess, "run", mock_run)
48
- result, _ = install_actionlint("Darwin")
51
+ result, _ = install_actionlint("Darwin", settings.actionlint_version)
49
52
  assert result is True
50
53
 
51
54
 
@@ -54,7 +57,7 @@ def test_failed_install_actionlint_darwin(monkeypatch):
54
57
  raise subprocess.CalledProcessError(1, "cmd")
55
58
 
56
59
  monkeypatch.setattr(subprocess, "run", mock_run)
57
- result, error = install_actionlint("Darwin")
60
+ result, error = install_actionlint("Darwin", settings.actionlint_version)
58
61
  assert result is False
59
62
  assert "An error occurred" in error
60
63
 
@@ -64,7 +67,7 @@ def test_install_actionlint_windows(monkeypatch):
64
67
  return subprocess.CompletedProcess(args, 0)
65
68
 
66
69
  monkeypatch.setattr(subprocess, "run", mock_run)
67
- result, _ = install_actionlint("Windows")
70
+ result, _ = install_actionlint("Windows", settings.actionlint_version)
68
71
  assert result is True
69
72
 
70
73
 
@@ -73,7 +76,7 @@ def test_failed_install_actionlint_windows(monkeypatch):
73
76
  raise subprocess.CalledProcessError(1, "cmd")
74
77
 
75
78
  monkeypatch.setattr(subprocess, "run", mock_run)
76
- result, error = install_actionlint("Windows")
79
+ result, error = install_actionlint("Windows", settings.actionlint_version)
77
80
  assert result is False
78
81
  assert "An error occurred" in error
79
82
 
@@ -84,7 +87,7 @@ def test_install_actionlint_source(monkeypatch):
84
87
 
85
88
  monkeypatch.setattr(subprocess, "run", mock_run)
86
89
 
87
- result, _ = install_actionlint_source("An error occurred")
90
+ result, _ = install_actionlint_source("An error occurred", settings.actionlint_version)
88
91
  assert result is True
89
92
 
90
93
 
@@ -94,7 +97,7 @@ def test_failed_install_actionlint_source(monkeypatch):
94
97
 
95
98
  monkeypatch.setattr(subprocess, "run", mock_run)
96
99
 
97
- result, error = install_actionlint_source("An error occurred")
100
+ result, error = install_actionlint_source("An error occurred", settings.actionlint_version)
98
101
  assert result is False
99
102
  assert "An error occurred" in error
100
103
 
@@ -105,7 +108,7 @@ def test_check_actionlint_installed(monkeypatch):
105
108
 
106
109
  monkeypatch.setattr(subprocess, "run", mock_run)
107
110
 
108
- result, _ = check_actionlint("Linux")
111
+ result, _ = check_actionlint("Linux", settings.actionlint_version)
109
112
  assert result is True
110
113
 
111
114
 
@@ -115,7 +118,7 @@ def test_failed_check_actionlint_installed(monkeypatch):
115
118
 
116
119
  monkeypatch.setattr(subprocess, "run", mock_run)
117
120
 
118
- result, _ = check_actionlint("Linux")
121
+ result, _ = check_actionlint("Linux", settings.actionlint_version)
119
122
  assert result is False
120
123
 
121
124
 
@@ -125,11 +128,13 @@ def test_check_actionlint_not_installed(monkeypatch):
125
128
 
126
129
  monkeypatch.setattr(subprocess, "run", mock_run)
127
130
 
128
- result, _ = check_actionlint("Linux")
131
+ result, _ = check_actionlint("Linux", settings.actionlint_version)
129
132
  assert result is False
130
133
 
131
134
 
132
135
  def test_run_actionlint_installed(monkeypatch, rule):
136
+ rule.settings = settings
137
+
133
138
  def mock_check_actionlint(*args, **kwargs):
134
139
  return True, "/mock/location"
135
140
 
@@ -148,6 +153,8 @@ def test_run_actionlint_installed(monkeypatch, rule):
148
153
 
149
154
 
150
155
  def test_run_actionlint_not_installed(monkeypatch, rule):
156
+ rule.settings = settings
157
+
151
158
  def mock_check_actionlint(*args, **kwargs):
152
159
  return False, ""
153
160
 
@@ -163,6 +170,8 @@ def test_run_actionlint_not_installed(monkeypatch, rule):
163
170
 
164
171
 
165
172
  def test_run_actionlint_installed_error(monkeypatch, rule):
173
+ rule.settings = settings
174
+
166
175
  def mock_check_actionlint(*args, **kwargs):
167
176
  return True, "/mock/location"
168
177