Skip to content

Commit

Permalink
@fr DT-16926 fixing sarif format parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyash86 committed Apr 7, 2021
1 parent 64ea266 commit ea1dad5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ async function run() {
testTagFilter: core.getInput("testTagFilter", { required: false }),
website: core.getInput("website", { required: false }),
workingDir: core.getInput("workingDir", { required: false }),
sarifMode: SarifMode_1.SarifMode[core.getInput("sarifMode", { required: false })],
sarifMode: SarifMode_1.SarifMode[capitalize(core.getInput("sarifMode", { required: false }))],
};
// #2 pass options to logic entry point
const run = new runner.AnalysisRunner();
Expand Down Expand Up @@ -306,6 +306,13 @@ async function run() {
}
}
exports.run = run;
function capitalize(s) {
if (s == undefined || s.length == 0)
return '';
if (s.length == 1)
return s.charAt(0).toUpperCase();
return s.charAt(0).toUpperCase() + s.slice(1);
}
if (require.main === require.cache[eval('__filename')]) {
run();
}
Expand Down
9 changes: 8 additions & 1 deletion src/run-dottest-analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function run() {
testTagFilter: core.getInput("testTagFilter", { required: false }),
website: core.getInput("website", { required: false }),
workingDir: core.getInput("workingDir", { required: false }),
sarifMode: SarifMode[core.getInput("sarifMode", { required: false })],
sarifMode: SarifMode[capitalize(core.getInput("sarifMode", { required: false }))],
};

// #2 pass options to logic entry point
Expand Down Expand Up @@ -87,6 +87,13 @@ export async function run() {
}
}

function capitalize(s: string) : string
{
if (s == undefined || s.length == 0) return '';
if (s.length == 1) return s.charAt(0).toUpperCase();
return s.charAt(0).toUpperCase() + s.slice(1);
}

if (require.main === module) {
run();
}

0 comments on commit ea1dad5

Please sign in to comment.