bitwarden_workflow_linter 0.2.0__tar.gz → 0.2.1__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.
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/PKG-INFO +1 -1
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/__about__.py +1 -1
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/default_settings.yaml +1 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/lint.py +5 -3
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/rules/job_environment_prefix.py +2 -1
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/rules/step_approved.py +2 -2
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/rules/step_pinned.py +1 -1
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/rules/underscore_outputs.py +21 -10
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/rules/test_step_pinned.py +1 -1
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/rules/test_underscore_output.py +1 -1
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.editorconfig +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.gitattributes +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/CODEOWNERS +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/renovate.json +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/workflows/_version_type.yml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/workflows/cd.yml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/workflows/ci.yml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/workflows/enforce-labels.yml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/workflows/scan.yml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.gitignore +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.husky/pre-commit +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.python-version +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/CONTRIBUTING.md +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/LICENSE.txt +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/Pipfile +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/Pipfile.lock +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/README.md +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/SECURITY.md +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/Taskfile.yml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/package-lock.json +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/package.json +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/pylintrc +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/pyproject.toml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/pyproject.toml.tpl +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/settings.yaml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/__init__.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/actions.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/cli.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/default_actions.json +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/load.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/models/__init__.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/models/job.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/models/step.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/models/workflow.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/rule.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/rules/__init__.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/rules/name_capitalized.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/rules/name_exists.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/rules/pinned_job_runner.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/src/bitwarden_workflow_linter/utils.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/__init__.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/conftest.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/fixtures/test-alt.yml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/fixtures/test-min-incorrect.yaml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/fixtures/test-min.yaml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/fixtures/test-outputs-incorrect.yml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/fixtures/test.yml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/fixtures/test_a.yaml +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/rules/__init__.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/rules/test_job_environment_prefix.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/rules/test_name_capitalized.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/rules/test_name_exists.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/rules/test_pinned_job_runner.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/rules/test_step_approved.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/test_job.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/test_lint.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/test_load.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/test_rule.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/test_step.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/test_utils.py +0 -0
- {bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/test_workflow.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: bitwarden_workflow_linter
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.1
|
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
|
@@ -4,6 +4,7 @@ enabled_rules:
|
|
4
4
|
- bitwarden_workflow_linter.rules.pinned_job_runner.RuleJobRunnerVersionPinned
|
5
5
|
- bitwarden_workflow_linter.rules.job_environment_prefix.RuleJobEnvironmentPrefix
|
6
6
|
- bitwarden_workflow_linter.rules.step_pinned.RuleStepUsesPinned
|
7
|
+
- bitwarden_workflow_linter.rules.step_pinned.RuleStepUsesPinned
|
7
8
|
- bitwarden_workflow_linter.rules.underscore_outputs.RuleUnderscoreOutputs
|
8
9
|
|
9
10
|
approved_actions_path: default_actions.json
|
@@ -54,6 +54,7 @@ class LinterCmd:
|
|
54
54
|
)
|
55
55
|
parser_lint.add_argument("-f", "--files", action="append", help="files to lint")
|
56
56
|
parser_lint.add_argument(
|
57
|
+
"-o",
|
57
58
|
"--output",
|
58
59
|
action="store",
|
59
60
|
help="output format: [stdout|json|md]",
|
@@ -137,9 +138,10 @@ class LinterCmd:
|
|
137
138
|
if os.path.isfile(path):
|
138
139
|
workflow_files.append(path)
|
139
140
|
elif os.path.isdir(path):
|
140
|
-
for
|
141
|
-
|
142
|
-
|
141
|
+
for dirpath, dirnames, filenames in os.walk(path):
|
142
|
+
dirnames[:] = []
|
143
|
+
for file in filenames:
|
144
|
+
filepath = dirpath + os.sep + file
|
143
145
|
if filepath.endswith((".yml", ".yaml")):
|
144
146
|
workflow_files.append(filepath)
|
145
147
|
|
@@ -58,11 +58,12 @@ class RuleJobEnvironmentPrefix(Rule):
|
|
58
58
|
incorrectly named environment variables.
|
59
59
|
"""
|
60
60
|
correct = True
|
61
|
+
allowed_envs = {"NODE_OPTION", "NUGET_PACKAGES", "MINT_PATH", "MINT_LINK_PATH"}
|
61
62
|
|
62
63
|
if obj.env:
|
63
64
|
offending_keys = []
|
64
65
|
for key in obj.env.keys():
|
65
|
-
if key[0] != "_":
|
66
|
+
if key not in allowed_envs and key[0] != "_":
|
66
67
|
offending_keys.append(key)
|
67
68
|
correct = False
|
68
69
|
|
@@ -41,8 +41,8 @@ class RuleStepUsesApproved(Rule):
|
|
41
41
|
if "@" not in obj.uses:
|
42
42
|
return True
|
43
43
|
|
44
|
-
## Force pass for any bitwarden/
|
45
|
-
if obj.uses.startswith("bitwarden/
|
44
|
+
## Force pass for any bitwarden/
|
45
|
+
if obj.uses.startswith("bitwarden/"):
|
46
46
|
return True
|
47
47
|
|
48
48
|
return False
|
@@ -25,7 +25,7 @@ class RuleUnderscoreOutputs(Rule):
|
|
25
25
|
A Settings object that contains any default, overridden, or custom settings
|
26
26
|
required anywhere in the application.
|
27
27
|
"""
|
28
|
-
self.message = "outputs with more than one word
|
28
|
+
self.message = "outputs with more than one word should use an underscore"
|
29
29
|
self.on_fail = LintLevels.WARNING
|
30
30
|
self.compatibility = [Workflow, Job, Step]
|
31
31
|
self.settings = settings
|
@@ -90,15 +90,18 @@ class RuleUnderscoreOutputs(Rule):
|
|
90
90
|
if isinstance(obj, Workflow):
|
91
91
|
if obj.on.get("workflow_dispatch"):
|
92
92
|
if obj.on["workflow_dispatch"].get("outputs"):
|
93
|
-
|
93
|
+
for output, _ in obj.on["workflow_dispatch"]["outputs"].items():
|
94
|
+
outputs.append(output)
|
94
95
|
|
95
96
|
if obj.on.get("workflow_call"):
|
96
97
|
if obj.on["workflow_call"].get("outputs"):
|
97
|
-
|
98
|
+
for output, _ in obj.on["workflow_call"]["outputs"].items():
|
99
|
+
outputs.append(output)
|
98
100
|
|
99
101
|
if isinstance(obj, Job):
|
100
102
|
if obj.outputs:
|
101
|
-
|
103
|
+
for output in obj.outputs.keys():
|
104
|
+
outputs.append(output)
|
102
105
|
|
103
106
|
if isinstance(obj, Step):
|
104
107
|
if obj.run:
|
@@ -108,10 +111,18 @@ class RuleUnderscoreOutputs(Rule):
|
|
108
111
|
)
|
109
112
|
)
|
110
113
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
114
|
+
correct = True
|
115
|
+
offending_keys = []
|
116
|
+
|
117
|
+
for name in outputs:
|
118
|
+
if "-" in name:
|
119
|
+
offending_keys.append(name)
|
120
|
+
correct = False
|
121
|
+
|
122
|
+
if correct:
|
123
|
+
return True, ""
|
116
124
|
|
117
|
-
return
|
125
|
+
return (
|
126
|
+
False,
|
127
|
+
f"{obj.__class__.__name__} {self.message}: ({' ,'.join(offending_keys)})",
|
128
|
+
)
|
{bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/rules/test_step_pinned.py
RENAMED
@@ -25,7 +25,7 @@ jobs:
|
|
25
25
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
26
26
|
|
27
27
|
- name: Test Internal Action
|
28
|
-
uses: bitwarden/
|
28
|
+
uses: bitwarden/ios/.github/actions/dispatch-and-download@main
|
29
29
|
|
30
30
|
- name: Test Local Action
|
31
31
|
uses: ./actions/test-action
|
@@ -234,7 +234,7 @@ def test_rule_on_incorrect_step(rule, incorrect_workflow):
|
|
234
234
|
|
235
235
|
result, message = rule.fn(incorrect_workflow.jobs["job-key"].steps[1])
|
236
236
|
assert result is False
|
237
|
-
assert
|
237
|
+
assert "outputs with more than one word should use an underscore" in message
|
238
238
|
|
239
239
|
result, _ = rule.fn(incorrect_workflow.jobs["job-key"].steps[2])
|
240
240
|
assert result is True
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/PULL_REQUEST_TEMPLATE.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/workflows/cd.yml
RENAMED
File without changes
|
{bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/workflows/ci.yml
RENAMED
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/.github/workflows/scan.yml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/fixtures/test-alt.yml
RENAMED
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/fixtures/test-min.yaml
RENAMED
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/fixtures/test_a.yaml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.2.0 → bitwarden_workflow_linter-0.2.1}/tests/rules/test_name_exists.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|