Skip to content

Commit 66981ec

Browse files
committed
chore: update comments
Signed-off-by: Ben Selwyn-Smith <[email protected]>
1 parent ab57622 commit 66981ec

File tree

14 files changed

+35
-35
lines changed

14 files changed

+35
-35
lines changed

src/macaron/database/db_custom_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class RFC3339DateTime(TypeDecorator): # pylint: disable=W0223
2525
https://docs.sqlalchemy.org/en/20/dialects/sqlite.html#sqlalchemy.dialects.sqlite.DATETIME
2626
"""
2727

28-
# It is stored in the database as a string
28+
# It is stored in the database as a string.
2929
impl = String
3030

3131
# To prevent Sphinx from rendering the docstrings for `cache_ok`, make this docstring private.

src/macaron/database/table_definitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
logger: logging.Logger = logging.getLogger(__name__)
4444

45-
# TODO: Use UUIDs as primary keys rather than incremental
45+
# TODO: Use UUIDs as primary keys rather than incremental.
4646

4747
################################################################################
4848
# Analysis

src/macaron/parsers/github_workflow_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2024 - 2025, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33
# pylint: skip-file
44
# flake8: noqa
@@ -7,7 +7,7 @@
77
# generated by datamodel-codegen:
88
# filename: https://raw.githubusercontent.com/SchemaStore/schemastore/a1689388470d1997f2e5ebd8b430e99587b8d354/src/schemas/json/github-workflow.json
99
# timestamp: 2024-05-10T03:46:22+00:00
10-
# Some manual modifications made, noted as MODIFIED in comments below
10+
# Some manual modifications made, noted as MODIFIED in comments below.
1111

1212
from __future__ import annotations
1313

tests/artifact/test_local_artifact.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def is_case_sensitive_filesystem() -> bool:
2929

3030
try:
3131
os.mkdir(upper)
32-
# if upper is not treated the same as lower -> case sensitive
32+
# If upper is not treated the same as lower -> case-sensitive.
3333
return True
3434
except FileExistsError:
35-
# upper is treated the same as lower -> case insensitive
35+
# Upper is treated the same as lower -> case-insensitive.
3636
return False
3737

3838

tests/macaron_testcase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 - 2023, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2022 - 2025, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
"""This module contains the MacaronTestCase class for setup/teardown of test cases."""
@@ -11,7 +11,7 @@
1111
from macaron.config.defaults import create_defaults, defaults, load_defaults
1212

1313

14-
# TODO: add fixture in the future
14+
# TODO: add fixture in the future.
1515
class MacaronTestCase(TestCase):
1616
"""The TestCase class for Macaron."""
1717

tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_nonexistent_rule_path(mock_defaults: MagicMock) -> None:
9393
@patch("macaron.malware_analyzer.pypi_heuristics.sourcecode.pypi_sourcecode_analyzer.defaults")
9494
def test_invalid_custom_rules(mock_defaults: MagicMock) -> None:
9595
"""Test for when the provided file is not a valid semgrep rule, so error,"""
96-
# use this file as an invalid semgrep rule as it is most definitely not a semgrep rule, and does exist
96+
# Use this file as an invalid semgrep rule as it is most definitely not a semgrep rule, and does exist.
9797
defaults = {
9898
"custom_semgrep_rules_path": os.path.abspath(__file__),
9999
}

tests/malware_analyzer/pypi/test_wheel_absence.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def test_analyze_no_information(pypi_package_json: MagicMock) -> None:
2222

2323

2424
# Note: to patch a function, the way it is imported matters.
25-
# e.g. if it is imported like this: import os; os.listdir() then you patch os.listdir
26-
# if it is imported like this: from os import listdir; listdir() then you patch <module>.listdir
25+
# E.g. if it is imported like this: import os; os.listdir() then you patch os.listdir.
26+
# If it is imported like this: from os import listdir; listdir() then you patch <module>.listdir.
2727
@patch("macaron.malware_analyzer.pypi_heuristics.metadata.wheel_absence.send_head_http_raw")
2828
def test_analyze_tar_present(mock_send_head_http_raw: MagicMock, pypi_package_json: MagicMock) -> None:
2929
"""Test for when only .tar.gz is present, so failed"""
@@ -72,7 +72,7 @@ def test_analyze_tar_present(mock_send_head_http_raw: MagicMock, pypi_package_js
7272
pypi_package_json.pypi_registry.inspector_url_scheme = "https"
7373
pypi_package_json.pypi_registry.inspector_url_netloc = "inspector.pypi.io"
7474

75-
mock_send_head_http_raw.return_value = MagicMock() # assume valid URL for testing purposes
75+
mock_send_head_http_raw.return_value = MagicMock() # Assume valid URL for testing purposes.
7676

7777
expected_detail_info = {
7878
"inspector_links": [inspector_link_expected],
@@ -131,7 +131,7 @@ def test_analyze_whl_present(mock_send_head_http_raw: MagicMock, pypi_package_js
131131
pypi_package_json.package_json = {"info": {"name": "ttttttttest_nester"}}
132132
pypi_package_json.pypi_registry.inspector_url_scheme = "https"
133133
pypi_package_json.pypi_registry.inspector_url_netloc = "inspector.pypi.io"
134-
mock_send_head_http_raw.return_value = MagicMock() # assume valid URL for testing purposes
134+
mock_send_head_http_raw.return_value = MagicMock() # Assume valid URL for testing purposes.
135135

136136
expected_detail_info = {
137137
"inspector_links": [inspector_link_expected],

tests/parsers/yaml/test_yaml_loader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 - 2022, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2022 - 2025, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
"""This module test the yaml loader functions."""
@@ -39,7 +39,7 @@ def test_load_yaml_content(self) -> None:
3939
def test_validate_yaml_data(self) -> None:
4040
"""Test the validate yaml data method."""
4141
# We are not testing the behavior of yamale methods
42-
# so the schema and data can be empty
42+
# so the schema and data can be empty.
4343
mock_schema = Schema({})
4444
mock_data: list = []
4545

tests/repo_finder/test_commit_finder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def test_version_to_tag_matching(_data: DataObject) -> None: # noqa: PT019
294294
This test verifies that a similar version and tag can be matched by the commit finder.
295295
"""
296296
# pylint: disable=protected-access
297-
# Generate the version
297+
# Generate the version.
298298
version = _data.draw(hypothesis.strategies.from_regex(input_pattern, fullmatch=True))
299299
if not version:
300300
return

tests/slsa_analyzer/build_tool/test_go.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2023 - 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2023 - 2025, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
"""This module tests the Go build functions."""
@@ -24,7 +24,7 @@
2424
def test_get_build_dirs(snapshot: list, tmp_path: Path, go_tool: Go, folder: str, file: str) -> None:
2525
"""Test discovering build directories."""
2626
# Since there's issues having 2 go.mod files in the same project, we make
27-
# it on the fly for this test
27+
# it on the fly for this test.
2828
proj_dir = tmp_path.joinpath(folder)
2929
proj_dir.mkdir(parents=True)
3030

tests/slsa_analyzer/checks/test_detect_malicious_metadata_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def test_detect_malicious_metadata(
125125
[
126126
pytest.param(
127127
{
128-
# similar to rule ID malware_high_confidence_1, but SUSPICIOUS_SETUP is skipped since the file does not
128+
# Similar to rule ID malware_high_confidence_1, but SUSPICIOUS_SETUP is skipped since the file does not
129129
# exist, so the rule should not trigger.
130130
Heuristics.EMPTY_PROJECT_LINK: HeuristicResult.FAIL,
131131
Heuristics.SOURCE_CODE_REPO: HeuristicResult.SKIP,

tests/slsa_analyzer/mock_git_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 - 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2022 - 2025, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
"""
@@ -44,7 +44,7 @@ def initiate_repo(repo_path: str | os.PathLike, git_init_options: dict | None =
4444
git_wrapper = Git(repo_path)
4545
return git_wrapper
4646
except GitError:
47-
# No git repo at repo_path
47+
# No git repo at repo_path.
4848
git.Repo.init(repo_path, **git_init_options)
4949
return Git(repo_path)
5050

@@ -65,7 +65,7 @@ def commit_files(git_wrapper: Git, file_names: list) -> bool:
6565
True if succeed else False.
6666
"""
6767
try:
68-
# Store the index object as recommended by the documentation
68+
# Store the index object as recommended by the documentation.
6969
current_index = git_wrapper.repo.index
7070
current_index.add(file_names)
7171
current_index.commit(f"Add files: {str(file_names)}")

tests/test_util.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 - 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2022 - 2025, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
"""
@@ -35,46 +35,46 @@ def test_construct_query(self) -> None:
3535
assert query == r"q=Some+simple+query+language%3Ajava&sort=stars&order=desc"
3636

3737
# TODO: the copy_file_bulk method is essential, however, this test
38-
# need further works.
38+
# needs further work.
3939
def test_copy_file_bulk(self) -> None:
4040
"""
4141
Test the copy file bulk method
4242
"""
4343
src_path = "/src/path"
4444
target_path = "/target/path"
4545

46-
# Testing making dir to store files
46+
# Testing making dir to store files.
4747
with patch("macaron.util.copy_file") as mock_copy_file:
4848
with patch("os.makedirs") as mock_make_dirs:
49-
# Empty file list, it does nothing
49+
# Empty file list, it does nothing.
5050
assert util.copy_file_bulk([], src_path, target_path)
5151
mock_copy_file.assert_not_called()
5252
mock_make_dirs.assert_not_called()
5353

5454
with patch("os.makedirs") as mock_make_dirs:
55-
# Test creating the dirs for storing the file
55+
# Test creating the dirs for storing the file.
5656
assert util.copy_file_bulk(["foo/file"], src_path, target_path)
5757
mock_make_dirs.assert_called_with("/target/path/foo", exist_ok=True)
5858

59-
# Testing copy behaviors
59+
# Testing copy behaviors.
6060
with patch("os.makedirs") as mock_make_dirs:
61-
# Test ignoring existed files
61+
# Test ignoring existed files.
6262
with patch("os.path.exists", return_value=True):
6363
with patch("macaron.util.copy_file") as mock_copy_file:
6464
assert util.copy_file_bulk(["file"], src_path, target_path)
6565
mock_copy_file.assert_not_called()
6666

67-
# Files not existed, perform the copy operation
67+
# Files do not exist, perform the copy operation.
6868
with patch("os.path.exists", return_value=False):
69-
# Test copying file successful
69+
# Test copying file successful.
7070
with patch("macaron.util.copy_file", return_value=True) as mock_copy_file:
7171
assert util.copy_file_bulk(["file"], src_path, target_path)
7272

73-
# Test copying file unsuccessful
73+
# Test copying file unsuccessful.
7474
with patch("macaron.util.copy_file", return_value=False) as mock_copy_file:
7575
assert not util.copy_file_bulk(["file"], src_path, target_path)
7676

77-
# Test copying multiple files
77+
# Test copying multiple files.
7878
with patch("macaron.util.copy_file", return_value=True) as mock_copy_file:
7979
assert util.copy_file_bulk(["foo/file1", "foo/file2"], src_path, target_path)
8080
mock_copy_file.assert_has_calls(

tests/vsa/compare_vsa.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2024 - 2025, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
"""Script to compare a generated VSA with an expected payload."""
@@ -139,7 +139,7 @@ def compare_list(
139139
if len(result) != len(expected):
140140
log_err(f"Expected field '{name}' of length {len(result)} in result to have length {len(expected)}")
141141
log_diff(name, result, expected)
142-
# Nothing else to compare
142+
# Nothing else to compare.
143143
return False
144144

145145
equal = True

0 commit comments

Comments
 (0)