Skip to content

Commit 39bd296

Browse files
authored
chore(deps-dev): update pre-commit hooks (#776)
Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
1 parent db4ebe2 commit 39bd296

File tree

7 files changed

+68
-49
lines changed

7 files changed

+68
-49
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ repos:
1717

1818
# Commitizen enforces semantic and conventional commit messages.
1919
- repo: https://github.com/commitizen-tools/commitizen
20-
rev: v3.13.0
20+
rev: v3.27.0
2121
hooks:
2222
- id: commitizen
2323
name: Check conventional commit message
2424
stages: [commit-msg]
2525

2626
# Sort imports.
2727
- repo: https://github.com/pycqa/isort
28-
rev: 5.12.0
28+
rev: 5.13.2
2929
hooks:
3030
- id: isort
3131
name: Sort import statements
3232
args: [--settings-path, pyproject.toml]
3333

3434
# Add Black code formatters.
3535
- repo: https://github.com/ambv/black
36-
rev: 23.11.0
36+
rev: 24.4.2
3737
hooks:
3838
- id: black
3939
name: Format code
@@ -48,7 +48,7 @@ repos:
4848

4949
# Upgrade and rewrite Python idioms.
5050
- repo: https://github.com/asottile/pyupgrade
51-
rev: v3.15.0
51+
rev: v3.16.0
5252
hooks:
5353
- id: pyupgrade
5454
name: Upgrade code idioms
@@ -69,7 +69,7 @@ repos:
6969

7070
# Check GitHub Actions workflow files.
7171
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
72-
rev: v1.6.26.11
72+
rev: v1.7.1.15
7373
hooks:
7474
- id: actionlint
7575

@@ -98,7 +98,7 @@ repos:
9898

9999
# Check for potential security issues.
100100
- repo: https://github.com/PyCQA/bandit
101-
rev: 1.7.5
101+
rev: 1.7.9
102102
hooks:
103103
- id: bandit
104104
name: Check for security issues
@@ -110,7 +110,7 @@ repos:
110110
# Enable a whole bunch of useful helper hooks, too.
111111
# See https://pre-commit.com/hooks.html for more hooks.
112112
- repo: https://github.com/pre-commit/pre-commit-hooks
113-
rev: v4.5.0
113+
rev: v4.6.0
114114
hooks:
115115
- id: check-ast
116116
- id: check-case-conflict
@@ -151,7 +151,7 @@ repos:
151151

152152
# Check and prettify the configuration files.
153153
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
154-
rev: v2.11.0
154+
rev: v2.13.0
155155
hooks:
156156
- id: pretty-format-ini
157157
args: [--autofix]
@@ -187,7 +187,7 @@ repos:
187187

188188
# A linter for Golang
189189
- repo: https://github.com/golangci/golangci-lint
190-
rev: v1.55.2
190+
rev: v1.59.1
191191
hooks:
192192
- id: golangci-lint
193193

src/macaron/parsers/github_workflow_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class Environment(TypedDict):
153153
# appears to be a datamodel-codegen issue, because workflow files that pass jsonschema validation end up with
154154
# a matrix value incompatible with the above type
155155
dict[str, Union[ExpressionSyntax, list[Configuration]]],
156-
ExpressionSyntax
156+
ExpressionSyntax,
157157
# END MODIFIED
158158
]
159159

src/macaron/slsa_analyzer/analyze_context.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,11 @@ def get_dict(self) -> dict:
242242
result = {
243243
"info": {
244244
"full_name": self.component.purl,
245-
"local_cloned_path": os.path.relpath(self.component.repository.fs_path, self.output_dir)
246-
if self.component.repository
247-
else "Unable to find a repository.",
245+
"local_cloned_path": (
246+
os.path.relpath(self.component.repository.fs_path, self.output_dir)
247+
if self.component.repository
248+
else "Unable to find a repository."
249+
),
248250
"remote_path": self.component.repository.remote_path if self.component.repository else "",
249251
"branch": self.component.repository.branch_name if self.component.repository else "",
250252
"commit_hash": self.component.repository.commit_sha if self.component.repository else "",

src/macaron/slsa_analyzer/checks/build_as_code_check.py

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,13 @@ def run_check(self, ctx: AnalyzeContext) -> CheckResultData:
175175
trigger_link = ci_service.api_client.get_file_link(
176176
ctx.component.repository.full_name,
177177
ctx.component.repository.commit_sha,
178-
file_path=ci_service.api_client.get_relative_path_of_workflow(
179-
os.path.basename(caller_path)
180-
)
181-
if caller_path
182-
else "",
178+
file_path=(
179+
ci_service.api_client.get_relative_path_of_workflow(
180+
os.path.basename(caller_path)
181+
)
182+
if caller_path
183+
else ""
184+
),
183185
)
184186
store_inferred_provenance(
185187
ctx=ctx,
@@ -228,28 +230,34 @@ def run_check(self, ctx: AnalyzeContext) -> CheckResultData:
228230
ci_info=ci_info,
229231
ci_service=ci_service,
230232
trigger_link=trigger_link,
231-
job_id=build_command["step_node"].caller.name
232-
if isinstance(build_command["step_node"].caller, GitHubJobNode)
233-
else None,
233+
job_id=(
234+
build_command["step_node"].caller.name
235+
if isinstance(build_command["step_node"].caller, GitHubJobNode)
236+
else None
237+
),
234238
step_id=build_command["step_node"].node_id,
235-
step_name=build_command["step_node"].name
236-
if isinstance(build_command["step_node"], BashNode)
237-
else None,
239+
step_name=(
240+
build_command["step_node"].name
241+
if isinstance(build_command["step_node"], BashNode)
242+
else None
243+
),
238244
)
239245
result_tables.append(
240246
BuildAsCodeFacts(
241247
build_tool_name=tool.name,
242248
ci_service_name=ci_service.name,
243249
build_trigger=trigger_link,
244250
language=build_command["language"],
245-
language_distributions=tool.serialize_to_json(
246-
build_command["language_distributions"]
247-
)
248-
if build_command["language_distributions"]
249-
else None,
250-
language_versions=tool.serialize_to_json(build_command["language_versions"])
251-
if build_command["language_versions"]
252-
else None,
251+
language_distributions=(
252+
tool.serialize_to_json(build_command["language_distributions"])
253+
if build_command["language_distributions"]
254+
else None
255+
),
256+
language_versions=(
257+
tool.serialize_to_json(build_command["language_versions"])
258+
if build_command["language_versions"]
259+
else None
260+
),
253261
language_url=build_command["language_url"],
254262
deploy_command=tool.serialize_to_json(build_command["command"]),
255263
confidence=confidence,

src/macaron/slsa_analyzer/checks/build_script_check.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,16 @@ def run_check(self, ctx: AnalyzeContext) -> CheckResultData:
130130
ci_service_name=ci_service.name,
131131
build_trigger=trigger_link,
132132
language=build_command["language"],
133-
language_distributions=tool.serialize_to_json(build_command["language_distributions"])
134-
if build_command["language_distributions"]
135-
else None,
136-
language_versions=tool.serialize_to_json(build_command["language_versions"])
137-
if build_command["language_versions"]
138-
else None,
133+
language_distributions=(
134+
tool.serialize_to_json(build_command["language_distributions"])
135+
if build_command["language_distributions"]
136+
else None
137+
),
138+
language_versions=(
139+
tool.serialize_to_json(build_command["language_versions"])
140+
if build_command["language_versions"]
141+
else None
142+
),
139143
language_url=build_command["language_url"],
140144
build_tool_command=tool.serialize_to_json(build_command["command"]),
141145
confidence=Confidence.HIGH,

src/macaron/slsa_analyzer/checks/build_service_check.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,16 @@ def run_check(self, ctx: AnalyzeContext) -> CheckResultData:
149149
ci_service_name=ci_service.name,
150150
build_trigger=trigger_link,
151151
language=build_command["language"],
152-
language_distributions=tool.serialize_to_json(
153-
build_command["language_distributions"]
154-
)
155-
if build_command["language_distributions"]
156-
else None,
157-
language_versions=tool.serialize_to_json(build_command["language_versions"])
158-
if build_command["language_versions"]
159-
else None,
152+
language_distributions=(
153+
tool.serialize_to_json(build_command["language_distributions"])
154+
if build_command["language_distributions"]
155+
else None
156+
),
157+
language_versions=(
158+
tool.serialize_to_json(build_command["language_versions"])
159+
if build_command["language_versions"]
160+
else None
161+
),
160162
language_url=build_command["language_url"],
161163
build_command=tool.serialize_to_json(build_command["command"]),
162164
confidence=confidence,

tests/parsers/bashparser/test_bashparser.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ def test_bashparser_parse(script_file_name: str, expected_json_file_name: str) -
2929
resources_dir = Path(__file__).parent.joinpath("resources")
3030

3131
# Parse the bash scripts.
32-
with open(os.path.join(resources_dir, "bash_files", script_file_name), encoding="utf8") as bash_file, open(
33-
os.path.join(resources_dir, "expected_results", expected_json_file_name), encoding="utf8"
34-
) as expected_file:
32+
with (
33+
open(os.path.join(resources_dir, "bash_files", script_file_name), encoding="utf8") as bash_file,
34+
open(
35+
os.path.join(resources_dir, "expected_results", expected_json_file_name), encoding="utf8"
36+
) as expected_file,
37+
):
3538
result = parse(bash_file.read(), MACARON_PATH)
3639
expected_result = json.load(expected_file)
3740
assert result == expected_result

0 commit comments

Comments
 (0)