Skip to content

Commit 20cca24

Browse files
committed
chore: rebase staging into add-python-as-a-supported-build-tool
Signed-off-by: sophie-bates <[email protected]>
2 parents 07d07ff + 9e52951 commit 20cca24

File tree

7 files changed

+12294
-110
lines changed

7 files changed

+12294
-110
lines changed

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ $(PACKAGE_PATH)/resources/mvnw:
107107
&& cd $(REPO_PATH)
108108
$(PACKAGE_PATH)/resources/gradlew:
109109
cd $(PACKAGE_PATH)/resources \
110-
&& export GRADLE_VERSION=7.6 \
111-
&& wget https://services.gradle.org/distributions/gradle-$$GRADLE_VERSION-bin.zip \
112-
&& unzip -o gradle-$$GRADLE_VERSION-bin.zip \
113-
&& rm -r gradle-$$GRADLE_VERSION-bin.zip \
114-
&& gradle-$$GRADLE_VERSION/bin/gradle wrapper \
115-
&& rm -rf gradle-$$GRADLE_VERSION \
116-
&& cd $(REPO_PATH)
110+
&& export GRADLE_VERSION=7.6 \
111+
&& wget https://services.gradle.org/distributions/gradle-$$GRADLE_VERSION-bin.zip \
112+
&& unzip -o gradle-$$GRADLE_VERSION-bin.zip \
113+
&& rm -r gradle-$$GRADLE_VERSION-bin.zip \
114+
&& gradle-$$GRADLE_VERSION/bin/gradle wrapper \
115+
&& rm -rf gradle-$$GRADLE_VERSION \
116+
&& cd $(REPO_PATH)
117117

118118
# Install or upgrade an existing virtual environment based on the
119119
# package dependencies declared in pyproject.toml and go.mod.

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,6 @@ make setup
164164

165165
With that in place, you’re ready to build and contribute to Macaron!
166166

167-
### Defining checks
168-
169-
After cloning a repository, Macaron parses the CI configuration files and bash scripts that are triggered by the CI, creates call graphs and other intermediate representations as abstractions. Using such abstractions, Macaron implements concrete checks to gather facts and metadata based on a security specification.
170-
171-
To learn how to define your own checks, see the steps in the [checks documentation](/src/macaron/slsa_analyzer/checks/README.md).
172-
173167
### Updating dependent packages
174168

175169
It’s likely that during development you’ll add or update dependent packages in the `pyproject.toml` file, which requires an update to the virtual environment:

src/macaron/dependency_analyzer/cyclonedx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def deserialize_bom_json(file_path: Path) -> dict:
5454

5555

5656
def get_root_component(root_bom_path: Path) -> Optional[dict | None]:
57-
"""Get dependency components.
57+
"""Get the root dependency component.
5858
5959
Parameters
6060
----------
@@ -107,8 +107,8 @@ def get_dep_components(
107107
logger.error("The BOM file at %s misses components.", str(root_bom_path))
108108
return
109109

110-
dependencies = []
111-
modules = set() # Stores all module dependencies.
110+
dependencies: list[str] = []
111+
modules: set[str] = set() # Stores all module dependencies.
112112
for child_path in child_bom_paths or []:
113113
try:
114114
bom_objects.append(deserialize_bom_json(child_path))

src/macaron/slsa_analyzer/analyzer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ def resolve_dependencies(self, main_ctx: AnalyzeContext) -> dict[str, Dependency
279279
with open(log_path, mode="a", encoding="utf-8") as log_file:
280280
log_file.write(error.output.decode("utf-8"))
281281
except FileNotFoundError as error:
282-
# Only happen if the gradlew at the repo dir has an invalid format
283282
logger.error(error)
284283

285284
# We collect the generated SBOM as a best effort, even if the build exits with errors.

src/macaron/slsa_analyzer/build_tool/base_build_tool.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ def get_build_dirs(self, repo_path: str) -> Iterable[Path]:
175175

176176
list_iter = iter(sorted(config_paths, key=lambda x: (str(Path(x).parent), len(Path(x).parts))))
177177
try:
178-
prefix = next(list_iter)
179-
yield Path(prefix).parent.relative_to(repo_path)
178+
cfg_path = next(list_iter)
179+
yield Path(cfg_path).parent.relative_to(repo_path)
180180
while next_item := next(list_iter):
181-
if str(Path(prefix).parent) in next_item:
181+
if str(Path(cfg_path).parent) in next_item:
182182
continue
183-
prefix = next_item
183+
cfg_path = next_item
184184
yield Path(next_item).parent.relative_to(repo_path)
185185

186186
except StopIteration:

0 commit comments

Comments
 (0)