Make parameter names more descriptive

This commit is contained in:
Robert Brignull 2020-07-02 14:45:14 +01:00
parent c41d287cae
commit 5ab09ae291
9 changed files with 68 additions and 61 deletions

36
lib/codeql.js generated
View file

@ -81,13 +81,13 @@ function getCodeQLForCmd(cmd) {
'--format=json'
]);
},
getTracerEnv: async function (database, compilerSpec) {
let envFile = path.resolve(database, 'working', 'env.tmp');
const compilerSpecArg = compilerSpec ? "--compiler-spec=" + compilerSpec : [];
getTracerEnv: async function (databasePath, compilerSpec) {
let envFile = path.resolve(databasePath, 'working', 'env.tmp');
const compilerSpecArg = compilerSpec ? ["--compiler-spec=" + compilerSpec] : [];
await exec.exec(cmd, [
'database',
'trace-command',
database,
databasePath,
...compilerSpecArg,
process.execPath,
path.resolve(__dirname, 'tracer-env.js'),
@ -95,16 +95,28 @@ function getCodeQLForCmd(cmd) {
]);
return JSON.parse(fs.readFileSync(envFile, 'utf-8'));
},
databaseInit: async function (database, language, sourceRoot) {
databaseInit: async function (databasePath, language, sourceRoot) {
await exec.exec(cmd, [
'database',
'init',
database,
databasePath,
'--language=' + language,
'--source-root=' + sourceRoot,
]);
},
extractScannedLanguage: async function (database, language) {
runAutobuild: async function (language) {
const cmdName = process.platform === 'win32' ? 'autobuild.cmd' : 'autobuild.sh';
const autobuildCmd = path.join(path.dirname(cmd), language, 'tools', cmdName);
// Update JAVA_TOOL_OPTIONS to contain '-Dhttp.keepAlive=false'
// This is because of an issue with Azure pipelines timing out connections after 4 minutes
// and Maven not properly handling closed connections
// Otherwise long build processes will timeout when pulling down Java packages
// https://developercommunity.visualstudio.com/content/problem/292284/maven-hosted-agent-connection-timeout.html
let javaToolOptions = process.env['JAVA_TOOL_OPTIONS'] || "";
process.env['JAVA_TOOL_OPTIONS'] = [...javaToolOptions.split(/\s+/), '-Dhttp.keepAlive=false', '-Dmaven.wagon.http.pool=false'].join(' ');
await exec.exec(autobuildCmd);
},
extractScannedLanguage: async function (databasePath, language) {
// Get extractor location
let extractorPath = '';
await exec.exec(cmd, [
@ -126,16 +138,16 @@ function getCodeQLForCmd(cmd) {
await exec.exec(cmd, [
'database',
'trace-command',
path.join(database, language),
databasePath,
'--',
traceCommand
]);
},
finalizeDatabase: async function (database, language) {
finalizeDatabase: async function (databasePath) {
await exec.exec(cmd, [
'database',
'finalize',
path.join(database, language)
databasePath
]);
},
resolveQueries: async function (queries) {
@ -154,13 +166,13 @@ function getCodeQLForCmd(cmd) {
});
return JSON.parse(output);
},
databaseAnalyze: async function (database, sarifFile, querySuite) {
databaseAnalyze: async function (databasePath, sarifFile, querySuite) {
await exec.exec(cmd, [
'database',
'analyze',
util.getMemoryFlag(),
util.getThreadsFlag(),
database,
databasePath,
'--format=sarif-latest',
'--output=' + sarifFile,
'--no-sarif-add-snippets',