From 85ea24bd2003323b26695b75118f87006bd8daac Mon Sep 17 00:00:00 2001
From: Eric Cornelissen <ericornelissen@gmail.com>
Date: Fri, 20 Nov 2020 11:00:55 +0100
Subject: [PATCH] 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
---
 src/actions-util.ts             |  6 +++---
 src/analyze.ts                  |  8 ++++----
 src/api-client.ts               |  2 +-
 src/autobuild-action.ts         |  2 +-
 src/codeql.ts                   | 21 +++++++++------------
 src/config-utils.test.ts        |  2 +-
 src/config-utils.ts             |  2 +-
 src/external-queries.test.ts    |  4 ++--
 src/external-queries.ts         |  6 +++---
 src/fingerprints.test.ts        |  8 ++++----
 src/fingerprints.ts             |  2 +-
 src/init.ts                     | 14 +++++++-------
 src/languages.test.ts           |  2 +-
 src/runner.ts                   |  2 +-
 src/toolrunner-error-catcher.ts |  4 ++--
 15 files changed, 41 insertions(+), 44 deletions(-)

diff --git a/src/actions-util.ts b/src/actions-util.ts
index 775c09c5e..30d2307ff 100644
--- a/src/actions-util.ts
+++ b/src/actions-util.ts
@@ -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");
diff --git a/src/analyze.ts b/src/analyze.ts
index f5a2366ef..ab5a8d921 100644
--- a/src/analyze.ts
+++ b/src/analyze.ts
@@ -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
diff --git a/src/api-client.ts b/src/api-client.ts
index 0ed6c3d68..adde23710 100644
--- a/src/api-client.ts
+++ b/src/api-client.ts
@@ -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(
diff --git a/src/autobuild-action.ts b/src/autobuild-action.ts
index 8d92713f9..c82778a3a 100644
--- a/src/autobuild-action.ts
+++ b/src/autobuild-action.ts
@@ -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;
diff --git a/src/codeql.ts b/src/codeql.ts
index 52519385a..3e2dbc838 100644
--- a/src/codeql.ts
+++ b/src/codeql.ts
@@ -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,
diff --git a/src/config-utils.test.ts b/src/config-utils.test.ts
index e2326c027..0610b99a0 100644
--- a/src/config-utils.test.ts
+++ b/src/config-utils.test.ts
@@ -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`;
diff --git a/src/config-utils.ts b/src/config-utils.ts
index f5f755682..68412e2d9 100644
--- a/src/config-utils.ts
+++ b/src/config-utils.ts
@@ -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.`
       )
     );
   }
diff --git a/src/external-queries.test.ts b/src/external-queries.test.ts
index 2ca1e1f6d..d1e399f8e 100644
--- a/src/external-queries.test.ts
+++ b/src/external-queries.test.ts
@@ -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,
           {
diff --git a/src/external-queries.ts b/src/external-queries.ts
index c5ac413cf..17fc1a5ff 100644
--- a/src/external-queries.ts
+++ b/src/external-queries.ts
@@ -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",
diff --git a/src/fingerprints.test.ts b/src/fingerprints.test.ts
index f2791f9e3..6e203eac7 100644
--- a/src/fingerprints.test.ts
+++ b/src/fingerprints.test.ts
@@ -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
diff --git a/src/fingerprints.ts b/src/fingerprints.ts
index 69fc441b6..0a7368369 100644
--- a/src/fingerprints.ts
+++ b/src/fingerprints.ts
@@ -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,
diff --git a/src/init.ts b/src/init.ts
index fd69358a4..f217a5401 100644
--- a/src/init.ts
+++ b/src/init.ts
@@ -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();
     }
diff --git a/src/languages.test.ts b/src/languages.test.ts
index 3d413b9da..5837c91f8 100644
--- a/src/languages.test.ts
+++ b/src/languages.test.ts
@@ -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);
diff --git a/src/runner.ts b/src/runner.ts
index 42899739f..11d704779 100644
--- a/src/runner.ts
+++ b/src/runner.ts
@@ -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));
 
diff --git a/src/toolrunner-error-catcher.ts b/src/toolrunner-error-catcher.ts
index 864da5e82..910e6a208 100644
--- a/src/toolrunner-error-catcher.ts
+++ b/src/toolrunner-error-catcher.ts
@@ -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,
       {