Skip to content

Commit

Permalink
test duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Brenden Cambier committed Apr 5, 2024
1 parent 840878b commit 34ec49e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 90 deletions.
46 changes: 2 additions & 44 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,56 +249,14 @@ async function run() {
try {
const findingResponse = await (0, api_1.getScanFindings)(secretKey, scanId);
core.info(`Received findings API response: ${JSON.stringify(findingResponse)}`);
const mockedFindingResponse = {
start_commit_id: 'fc773d95213d1c1e35acaceac6e37b036abcd09e',
end_commit_id: 'fc773d95213d1c1e35acaceac6e37b036abcd09e',
introduced_sast_issues: [
{
start_line: 117,
end_line: 117,
snippet_hash: '123',
title: 'Test.',
description: 'This is a test.',
remediation: 'Carry on.',
file: 'dist/index.js'
},
{
start_line: 120,
end_line: 120,
snippet_hash: '124',
title: 'Test.',
description: 'This is a test.',
remediation: 'Carry on.',
file: 'dist/index.js'
},
{
start_line: 137,
end_line: 137,
snippet_hash: '127',
title: 'Test.',
description: 'This is a test.',
remediation: 'Carry on.',
file: 'dist/index.js'
},
{
start_line: 234,
end_line: 250,
snippet_hash: '125',
title: 'Test.',
description: 'This is a test.',
remediation: 'Carry on.',
file: 'dist/index.js'
},
]
};
const findings = findingResponse.introduced_sast_issues.map(finding => ({
commit_id: findingResponse.end_commit_id,
path: finding.file,
line: finding.end_line,
start_line: finding.start_line,
body: `Finding: ${finding.title}\nDescription: ${finding.description}\nPossible remediation: ${finding.remediation}`
body: `**Finding:** ${finding.title}\n**Description:** ${finding.description}\n**Possible remediation:** ${finding.remediation}`
}));
core.info(`Received following findings: ${JSON.stringify(findings)}`);
core.info(`Parsed following findings: ${JSON.stringify(findings)}`);
if (findings.length > 0) {
await (0, postReviewComment_1.postFindingsAsReviewComments)(findings);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

47 changes: 2 additions & 45 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,60 +151,17 @@ async function run(): Promise<void> {
try {
const findingResponse = await getScanFindings(secretKey, scanId)
core.info(`Received findings API response: ${JSON.stringify(findingResponse)}`);

const mockedFindingResponse = {
start_commit_id: 'fc773d95213d1c1e35acaceac6e37b036abcd09e',
end_commit_id: 'fc773d95213d1c1e35acaceac6e37b036abcd09e',
introduced_sast_issues: [
{
start_line: 117,
end_line: 117,
snippet_hash: '123',
title: 'Test.',
description: 'This is a test.',
remediation: 'Carry on.',
file: 'dist/index.js'
},
{
start_line: 120,
end_line: 120,
snippet_hash: '124',
title: 'Test.',
description: 'This is a test.',
remediation: 'Carry on.',
file: 'dist/index.js'
},
{
start_line: 137,
end_line: 137,
snippet_hash: '127',
title: 'Test.',
description: 'This is a test.',
remediation: 'Carry on.',
file: 'dist/index.js'
},
{
start_line: 234,
end_line: 250,
snippet_hash: '125',
title: 'Test.',
description: 'This is a test.',
remediation: 'Carry on.',
file: 'dist/index.js'
},
]
}

const findings = findingResponse.introduced_sast_issues.map(finding => (
{
commit_id: findingResponse.end_commit_id,
path: finding.file,
line: finding.end_line,
start_line: finding.start_line,
body: `Finding: ${finding.title}\nDescription: ${finding.description}\nPossible remediation: ${finding.remediation}`
body: `**Finding:** ${finding.title}\n**Description:** ${finding.description}\n**Possible remediation:** ${finding.remediation}`
}
))
core.info(`Received following findings: ${JSON.stringify(findings)}`);
core.info(`Parsed following findings: ${JSON.stringify(findings)}`);

if (findings.length > 0) {
await postFindingsAsReviewComments(findings);
Expand Down
3 changes: 3 additions & 0 deletions src/test2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
phpinfo();
?>

0 comments on commit 34ec49e

Please sign in to comment.