Skip to content

Commit

Permalink
Reduce validation errors
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Jan 20, 2025
1 parent daabb52 commit 5b4c4bd
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
29 changes: 29 additions & 0 deletions lib/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5009,6 +5009,35 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
) {
dependentPkg.properties.push(pprop);
addedValue[pprop.value] = true;
} else if (pprop.name === "internal:is_workspace") {
dependentPkg.properties.push({
name: "internal:workspaceRef",
value: parentPkg["bom-ref"],
});
dependentPkg.properties.push({
name: "internal:workspaceSrcFile",
value: workspaceRefPyProjMap[parentPkg["bom-ref"]],
});
addedValue[parentPkg["bom-ref"]] = true;
addedValue[workspaceRefPyProjMap[parentPkg["bom-ref"]]] = true;
const childDeps = depsMap[dependentPkg["bom-ref"]];
for (const childRef of childDeps) {
if (!childRef.startsWith("pkg:")) {
continue;
}
const childPkg = pkgBomRefMap[childRef];
if (childPkg) {
childPkg.properties = childPkg.properties || [];
childPkg.properties.push({
name: "internal:workspaceRef",
value: parentPkg["bom-ref"],
});
childPkg.properties.push({
name: "internal:workspaceSrcFile",
value: workspaceRefPyProjMap[parentPkg["bom-ref"]],
});
}
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/helpers/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ export function validateProps(bomJson) {
if (
["library", "framework"].includes(comp.type) &&
isWorkspaceMode &&
!workspacePropFound
!workspacePropFound &&
comp?.scope !== "optional"
) {
warningsList.push(
`${comp["bom-ref"]} lacks workspace-related properties.`,
Expand Down
2 changes: 1 addition & 1 deletion types/lib/helpers/utils.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion types/lib/helpers/validator.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5b4c4bd

Please sign in to comment.