Skip to content

Commit

Permalink
fix: make IaC issue resource file optional (#4763)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofekatr committed Aug 1, 2023
1 parent 560e1ab commit 76109c7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/lib/formatters/iac-output/text/issues-list/index.ts
Expand Up @@ -41,8 +41,8 @@ export function getIacDisplayedIssues(
const issuesOutput = severityResults
.sort(
(severityResult1, severityResult2) =>
severityResult1.targetFile.localeCompare(
severityResult2.targetFile,
severityResult1.targetFile?.localeCompare(
severityResult2.targetFile as string,
) ||
severityResult1.issue.id.localeCompare(severityResult2.issue.id),
)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/formatters/iac-output/text/types.ts
Expand Up @@ -16,8 +16,8 @@ export type FormattedOutputResultsBySeverity = {

export type FormattedOutputResult = {
issue: Issue;
targetFile: string;
projectType: IacProjectType | State.InputTypeEnum;
targetFile?: string;
};

export interface IacTestCounts {
Expand Down
4 changes: 3 additions & 1 deletion src/lib/iac/test/v2/analytics/iac-type.ts
Expand Up @@ -75,7 +75,9 @@ function getFilesCountByPackageManager(
acc[packageManager] = new Set();
}

acc[packageManager].add(resource.file);
if (resource.file) {
acc[packageManager].add(resource.file);
}

return acc;
}, {} as { [packageManager in PackageManager]: Set<string> }),
Expand Down
6 changes: 3 additions & 3 deletions src/lib/iac/test/v2/scan/results.ts
Expand Up @@ -112,10 +112,10 @@ export interface Rule {
export interface Resource {
id: string;
type: string;
path?: any[];
formattedPath: string;
file: string;
kind: ResourceKind;
formattedPath: string;
path?: any[];
file?: string;
line?: number;
column?: number;
}
Expand Down

0 comments on commit 76109c7

Please sign in to comment.