Fix typos in src

- Rename "toolrunnner" (three 'n') to "toolrunner"
- Rename "relativeFilepaht" to "relativeFilepath"
- Fix various typos in documentation & comments
- Fix typos in logs and test names
This commit is contained in:
Eric Cornelissen 2020-11-20 11:00:55 +01:00
parent aafb457527
commit 85ea24bd20
15 changed files with 41 additions and 44 deletions

View file

@ -1,7 +1,7 @@
import * as path from "path";
import * as core from "@actions/core";
import * as toolrunnner from "@actions/exec/lib/toolrunner";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as safeWhich from "@chrisgavin/safe-which";
import * as api from "./api-client";
@ -76,7 +76,7 @@ export const getCommitOid = async function (): Promise<string> {
// reported on the merge commit.
try {
let commitOid = "";
await new toolrunnner.ToolRunner(
await new toolrunner.ToolRunner(
await safeWhich.safeWhich("git"),
["rev-parse", "HEAD"],
{
@ -366,7 +366,7 @@ export function isRunningLocalAction(): boolean {
);
}
// Get the location where the action is runnning from.
// Get the location where the action is running from.
// This can be used to get the actions name or tell if we're running a local action.
export function getRelativeScriptPath(): string {
const runnerTemp = getRequiredEnvParam("RUNNER_TEMP");

View file

@ -1,7 +1,7 @@
import * as fs from "fs";
import * as path from "path";
import * as toolrunnner from "@actions/exec/lib/toolrunner";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as analysisPaths from "./analysis-paths";
import { getCodeQL } from "./codeql";
@ -49,7 +49,7 @@ export interface QueriesStatusReport {
analyze_custom_queries_javascript_duration_ms?: number;
// Time taken in ms to analyze custom queries for python (or undefined if this language was not analyzed)
analyze_custom_queries_python_duration_ms?: number;
// Name of language that errored during analysis (or undefined if no langauge failed)
// Name of language that errored during analysis (or undefined if no language failed)
analyze_failure_language?: string;
}
@ -73,7 +73,7 @@ async function setupPythonExtractor(logger: Logger) {
},
};
await new toolrunnner.ToolRunner(
await new toolrunner.ToolRunner(
codeqlPython,
[
"-c",
@ -85,7 +85,7 @@ async function setupPythonExtractor(logger: Logger) {
process.env["LGTM_INDEX_IMPORT_PATH"] = output;
output = "";
await new toolrunnner.ToolRunner(
await new toolrunner.ToolRunner(
codeqlPython,
["-c", "import sys; print(sys.version_info[0])"],
options

View file

@ -101,7 +101,7 @@ function getApiUrl(githubUrl: string): string {
}
// Temporary function to aid in the transition to running on and off of github actions.
// Once all code has been coverted this function should be removed or made canonical
// Once all code has been converted this function should be removed or made canonical
// and called only from the action entrypoints.
export function getActionsApiClient(allowLocalRun = false) {
return getApiClient(

View file

@ -7,7 +7,7 @@ import { Language } from "./languages";
import { getActionsLogger } from "./logging";
interface AutobuildStatusReport extends actionsUtil.StatusReportBase {
// Comma-separated set of languages being autobuilt
// Comma-separated set of languages being autobuild
autobuild_languages: string;
// Language that failed autobuilding (or undefined if all languages succeeded).
autobuild_failure?: string;

View file

@ -3,7 +3,7 @@ import * as path from "path";
import * as stream from "stream";
import * as globalutil from "util";
import * as toolrunnner from "@actions/exec/lib/toolrunner";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as http from "@actions/http-client";
import { IHeaders } from "@actions/http-client/interfaces";
import * as toolcache from "@actions/tool-cache";
@ -68,7 +68,7 @@ export interface CodeQL {
runAutobuild(language: Language): Promise<void>;
/**
* Extract code for a scanned language using 'codeql database trace-command'
* and running the language extracter.
* and running the language extractor.
*/
extractScannedLanguage(database: string, language: Language): Promise<void>;
/**
@ -438,10 +438,7 @@ function getCodeQLForCmd(cmd: string): CodeQL {
return cmd;
},
async printVersion() {
await new toolrunnner.ToolRunner(cmd, [
"version",
"--format=json",
]).exec();
await new toolrunner.ToolRunner(cmd, ["version", "--format=json"]).exec();
},
async getTracerEnv(databasePath: string) {
// Write tracer-env.js to a temp location.
@ -468,7 +465,7 @@ function getCodeQLForCmd(cmd: string): CodeQL {
);
const envFile = path.resolve(databasePath, "working", "env.tmp");
await new toolrunnner.ToolRunner(cmd, [
await new toolrunner.ToolRunner(cmd, [
"database",
"trace-command",
databasePath,
@ -484,7 +481,7 @@ function getCodeQLForCmd(cmd: string): CodeQL {
language: Language,
sourceRoot: string
) {
await new toolrunnner.ToolRunner(cmd, [
await new toolrunner.ToolRunner(cmd, [
"database",
"init",
databasePath,
@ -515,12 +512,12 @@ function getCodeQLForCmd(cmd: string): CodeQL {
"-Dmaven.wagon.http.pool=false",
].join(" ");
await new toolrunnner.ToolRunner(autobuildCmd).exec();
await new toolrunner.ToolRunner(autobuildCmd).exec();
},
async extractScannedLanguage(databasePath: string, language: Language) {
// Get extractor location
let extractorPath = "";
await new toolrunnner.ToolRunner(
await new toolrunner.ToolRunner(
cmd,
[
"resolve",
@ -592,7 +589,7 @@ function getCodeQLForCmd(cmd: string): CodeQL {
codeqlArgs.push("--search-path", extraSearchPath);
}
let output = "";
await new toolrunnner.ToolRunner(cmd, codeqlArgs, {
await new toolrunner.ToolRunner(cmd, codeqlArgs, {
listeners: {
stdout: (data: Buffer) => {
output += data.toString();
@ -610,7 +607,7 @@ function getCodeQLForCmd(cmd: string): CodeQL {
addSnippetsFlag: string,
threadsFlag: string
) {
await new toolrunnner.ToolRunner(cmd, [
await new toolrunner.ToolRunner(cmd, [
"database",
"analyze",
memoryFlag,

View file

@ -354,7 +354,7 @@ test("Default queries are used", async (t) => {
// The important point of this config is that it doesn't specify
// the disable-default-queries field.
// Any other details are hopefully irrelevant for this tetst.
// Any other details are hopefully irrelevant for this test.
const inputFileContents = `
paths:
- foo`;

View file

@ -419,7 +419,7 @@ export function validateAndSanitisePath(
configFile,
propertyName,
`"${originalPath}" contains an invalid "**" wildcard. ` +
`They must be immediately preceeded and followed by a slash as in "/**/", or come at the start or end.`
`They must be immediately preceded and followed by a slash as in "/**/", or come at the start or end.`
)
);
}

View file

@ -1,7 +1,7 @@
import * as fs from "fs";
import * as path from "path";
import * as toolrunnner from "@actions/exec/lib/toolrunner";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as safeWhich from "@chrisgavin/safe-which";
import test from "ava";
@ -37,7 +37,7 @@ test("checkoutExternalQueries", async (t) => {
];
console.log(`Running: git ${command.join(" ")}`);
try {
await new toolrunnner.ToolRunner(
await new toolrunner.ToolRunner(
await safeWhich.safeWhich("git"),
command,
{

View file

@ -1,7 +1,7 @@
import * as fs from "fs";
import * as path from "path";
import * as toolrunnner from "@actions/exec/lib/toolrunner";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as safeWhich from "@chrisgavin/safe-which";
import { Logger } from "./logging";
@ -29,12 +29,12 @@ export async function checkoutExternalRepository(
if (!fs.existsSync(checkoutLocation)) {
const repoURL = `${githubUrl}/${repository}`;
await new toolrunnner.ToolRunner(await safeWhich.safeWhich("git"), [
await new toolrunner.ToolRunner(await safeWhich.safeWhich("git"), [
"clone",
repoURL,
checkoutLocation,
]).exec();
await new toolrunnner.ToolRunner(await safeWhich.safeWhich("git"), [
await new toolrunner.ToolRunner(await safeWhich.safeWhich("git"), [
`--work-tree=${checkoutLocation}`,
`--git-dir=${checkoutLocation}/.git`,
"checkout",

View file

@ -123,16 +123,16 @@ test("resolveUriToFile", (t) => {
const cwd = process.cwd();
const filepath = __filename;
t.true(filepath.startsWith(`${cwd}/`));
const relativeFilepaht = filepath.substring(cwd.length + 1);
const relativeFilepath = filepath.substring(cwd.length + 1);
// Absolute paths are unmodified
t.is(testResolveUriToFile(filepath, undefined, []), filepath);
t.is(testResolveUriToFile(`file://${filepath}`, undefined, []), filepath);
// Relative paths are made absolute
t.is(testResolveUriToFile(relativeFilepaht, undefined, []), filepath);
t.is(testResolveUriToFile(relativeFilepath, undefined, []), filepath);
t.is(
testResolveUriToFile(`file://${relativeFilepaht}`, undefined, []),
testResolveUriToFile(`file://${relativeFilepath}`, undefined, []),
filepath
);
@ -151,7 +151,7 @@ test("resolveUriToFile", (t) => {
t.is(testResolveUriToFile(1, undefined, []), undefined);
t.is(testResolveUriToFile(undefined, undefined, []), undefined);
// Non-existant files are discarded
// Non-existent files are discarded
t.is(testResolveUriToFile(`${filepath}2`, undefined, []), undefined);
// Index is resolved

View file

@ -125,7 +125,7 @@ export function hash(callback: hashCallback, input: string) {
}
// Generate a hash callback function that updates the given result in-place
// when it recieves a hash for the correct line number. Ignores hashes for other lines.
// when it receives a hash for the correct line number. Ignores hashes for other lines.
function locationUpdateCallback(
result: any,
location: any,

View file

@ -1,7 +1,7 @@
import * as fs from "fs";
import * as path from "path";
import * as toolrunnner from "@actions/exec/lib/toolrunner";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as safeWhich from "@chrisgavin/safe-which";
import * as analysisPaths from "./analysis-paths";
@ -172,7 +172,7 @@ export async function injectWindowsTracer(
const injectTracerPath = path.join(config.tempDir, "inject-tracer.ps1");
fs.writeFileSync(injectTracerPath, script);
await new toolrunnner.ToolRunner(
await new toolrunner.ToolRunner(
await safeWhich.safeWhich("powershell"),
[
"-ExecutionPolicy",
@ -199,12 +199,12 @@ export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
if (process.env["ImageOS"] !== undefined) {
try {
if (process.platform === "win32") {
await new toolrunnner.ToolRunner(
await new toolrunner.ToolRunner(
await safeWhich.safeWhich("powershell"),
[path.join(scriptsFolder, "install_tools.ps1")]
).exec();
} else {
await new toolrunnner.ToolRunner(
await new toolrunner.ToolRunner(
path.join(scriptsFolder, "install_tools.sh")
).exec();
}
@ -213,7 +213,7 @@ export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
// we just abort the process without failing the action
logger.endGroup();
logger.warning(
"Unable to download and extract the tools needed for installing the python dependecies. You can call this action with 'setup-python-dependencies: false' to disable this process."
"Unable to download and extract the tools needed for installing the python dependencies. You can call this action with 'setup-python-dependencies: false' to disable this process."
);
return;
}
@ -223,13 +223,13 @@ export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
try {
const script = "auto_install_packages.py";
if (process.platform === "win32") {
await new toolrunnner.ToolRunner(await safeWhich.safeWhich("py"), [
await new toolrunner.ToolRunner(await safeWhich.safeWhich("py"), [
"-3",
path.join(scriptsFolder, script),
path.dirname(codeql.getPath()),
]).exec();
} else {
await new toolrunnner.ToolRunner(path.join(scriptsFolder, script), [
await new toolrunner.ToolRunner(path.join(scriptsFolder, script), [
path.dirname(codeql.getPath()),
]).exec();
}

View file

@ -10,7 +10,7 @@ import { setupTests } from "./testing-utils";
setupTests(test);
test("parseLangauge", async (t) => {
test("parseLanguage", async (t) => {
// Exact matches
t.deepEqual(parseLanguage("csharp"), Language.csharp);
t.deepEqual(parseLanguage("cpp"), Language.cpp);

View file

@ -193,7 +193,7 @@ program
);
}
// Always output a json file of the env that can be consumed programatically
// Always output a json file of the env that can be consumed programmatically
const jsonEnvFile = path.join(config.tempDir, codeqlEnvJsonFilename);
fs.writeFileSync(jsonEnvFile, JSON.stringify(tracerConfig.env));

View file

@ -1,5 +1,5 @@
import * as im from "@actions/exec/lib/interfaces";
import * as toolrunnner from "@actions/exec/lib/toolrunner";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as safeWhich from "@chrisgavin/safe-which";
import { ErrorMatcher } from "./error-matcher";
@ -48,7 +48,7 @@ export async function toolrunnerErrorCatcher(
// we capture the original return code or error so that if no match is found we can duplicate the behavior
let returnState: Error | number;
try {
returnState = await new toolrunnner.ToolRunner(
returnState = await new toolrunner.ToolRunner(
await safeWhich.safeWhich(commandLine),
args,
{