Skip to content

Commit

Permalink
Turn on no-trailing-whitespace linting
Browse files Browse the repository at this point in the history
  • Loading branch information
itowlson committed May 1, 2018
1 parent 130a7f7 commit b8f3e21
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/binutil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export async function checkForBinary(context: BinCheckContext, bin: string, binN
}

context.binFound = context.fs.existsSync(bin);

if (context.binFound) {
context.binPath = bin;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/components/clusterprovider/clusterproviderserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function handleGetProviderListHtml(action: clusterproviderregistry.ClusterProvid
document.getElementById('nextlink').href = selection;
}
`);

const html = `<html><body><h1 id='h'>Choose cluster type</h1>
<style id='styleholder'>
</style>
Expand Down
2 changes: 1 addition & 1 deletion src/components/installer/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function installKubectl(shell: Shell): Promise<Errorable<void>> {

const installFolder = getInstallFolder(shell, tool);
mkdirp.sync(installFolder);

const kubectlUrl = `https://storage.googleapis.com/kubernetes-release/release/${version.result.trim()}/bin/${os}/amd64/${binFile}`;
const downloadFile = path.join(installFolder, binFile);
const downloadResult = await downloadTo(kubectlUrl, downloadFile);
Expand Down
6 changes: 3 additions & 3 deletions src/debug/debugProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface IDebugProvider {

/**
* Launch the debugger extension and attach to the target debug port.
*
*
* @param workspaceFolder the workspace folder path.
* @param sessionName the debug session name.
* @param port the debugging port exposed by the target program.
Expand All @@ -32,15 +32,15 @@ export interface IDebugProvider {

/**
* The docker image is supported by the provider or not.
*
*
* @param baseImage the inherited image name.
* @return true if the provider can infer the application type from the image name, otherwise, false.
*/
isSupportedImage(baseImage: string): boolean;

/**
* Resolve the debug port info from the dockerfile.
*
*
* @param dockerfile the docker file.
* @param env the environment variables defined by the docker file.
* @return the resolved debug port info.
Expand Down
14 changes: 7 additions & 7 deletions src/debug/debugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ export class DebugSession implements IDebugSession {

/**
* In launch mode, build the docker image from docker file first and then run it on kubernetes cluster,
* after that smartly resolve the debugging info from the docker image and create port-forward,
* after that smartly resolve the debugging info from the docker image and create port-forward,
* finally start a debugger to attach to the debugging process.
*
*
* Besides, when the debug session is terminated, kill the port-forward and cleanup the created kubernetes resources (deployment/pod) automatically.
*
*
* @param workspaceFolder the active workspace folder.
* @param debugProvider the debug provider. If not specified, prompt user to pick up a debug provider from the supported list.
*/
Expand Down Expand Up @@ -89,15 +89,15 @@ export class DebugSession implements IDebugSession {
// Find the running debug pod.
p.report({ message: "Finding the debug pod..."});
const podName = await this.findDebugPod(appName);

// Wait for the debug pod status to be running.
p.report({ message: "Waiting for the pod to be ready..."});
await this.waitForPod(podName);

// Setup port-forward.
p.report({ message: "Setting up port forwarding..."});
const proxyResult = await this.setupPortForward(podName, portInfo.debugPort, portInfo.appPort);

// Start debug session.
p.report({ message: `Starting ${this.debugProvider.getDebuggerType()} debug session...`});
await this.startDebugSession(appName, cwd, proxyResult);
Expand Down Expand Up @@ -255,7 +255,7 @@ export class DebugSession implements IDebugSession {
kubeChannel.showOutput(`Setting up port forwarding on pod ${podName}...`, "Set up port forwarding");
const proxyResult = await this.createPortForward(this.kubectl, podName, debugPort, appPort);
kubeChannel.showOutput(`Created port-forward ${proxyResult.proxyDebugPort}:${debugPort} ${appPort ? proxyResult.proxyAppPort + ":" + appPort : ""}`);

// Wait for the port-forward proxy to be ready.
kubeChannel.showOutput("Waiting for port forwarding to be ready...");
await this.waitForProxyReady(proxyResult.proxyProcess);
Expand Down
2 changes: 1 addition & 1 deletion src/debug/providerRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function showProviderPick(): Promise<IDebugProvider> {
provider
};
});

const pickedProvider = await vscode.window.showQuickPick(<vscode.QuickPickItem[]> providerItems, { placeHolder: "Select the environment" });
if (!pickedProvider) {
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/docker/dockerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export enum DockerClient {

/**
* Build the docker image first. If imagePrefix is not empty, push the image to remote docker hub, too.
*
*
* @param dockerClient the possible dockerClient: docker or docker-compose.
* @param shellOpts any option available to Node.js's child_process.exec().
* @param imagePrefix the image prefix for docker images (e.g. 'docker.io/brendanburns').
Expand Down Expand Up @@ -86,7 +86,7 @@ export async function resolveKubernetesDockerEnv(kubectl: Kubectl): Promise<{}>
if (!currentCluster || !currentCluster.server || !currentCluster.certificateAuthority) {
return {};
}

if (/^https/.test(currentCluster.server)) {
dockerEnv["DOCKER_TLS_VERIFY"] = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export async function activate(context): Promise<extensionapi.ExtensionAPI> {
];

const draftDebugProvider = new DraftConfigurationProvider();
let draftDebugSession: vscode.DebugSession;
let draftDebugSession: vscode.DebugSession;

const subscriptions = [

Expand Down Expand Up @@ -217,7 +217,7 @@ export async function activate(context): Promise<extensionapi.ExtensionAPI> {
}
}
});

vscode.debug.onDidTerminateDebugSession((e) => {

// if there is an active Draft debugging session, restart the cycle
Expand Down
2 changes: 1 addition & 1 deletion src/extensionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { shell, ShellResult } from "./shell";

/**
* Install a vscode extension programmatically.
*
*
* @param extensionId the extension id.
*/
export async function installVscodeExtension(extensionId: string): Promise<boolean> {
Expand Down
4 changes: 2 additions & 2 deletions src/helm.completionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as _ from 'lodash';
import {existsSync} from 'fs';

export class HelmTemplateCompletionProvider implements vscode.CompletionItemProvider {

private valuesMatcher = new RegExp('\\s+\\.Values\\.([a-zA-Z0-9\\._-]+)?$');
private funcmap = new FuncMap();

Expand Down Expand Up @@ -96,7 +96,7 @@ export class HelmTemplateCompletionProvider implements vscode.CompletionItemProv
logger.helm.log(err.message);
return [];
}

// If this does not match the valuesMatcher (Not a .Values.SOMETHING...) then
// we return right away.
if (!res || res.length == 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/helm.documentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class HelmInspectDocumentProvider implements vscode.TextDocumentContentPr
exec.helmExec(`inspect values "${path}"`, printer);
});
});

}
}

Expand Down Expand Up @@ -89,11 +89,11 @@ export class HelmTemplatePreviewDocumentProvider implements vscode.TextDocumentC
vscode.window.showErrorMessage(`YAML failed to parse: ${ e.message }`);
}
}

resolve(previewBody(reltpl, out));
});
});
});

}
}
4 changes: 2 additions & 2 deletions src/helm.funcmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class FuncMap {
]
}
public releaseVals(): vscode.CompletionItem[] {
return [
return [
this.v("Name", ".Release.Name", "Name of the release"),
this.v("Time", ".Release.Time", "Time of the release"),
this.v("Namespace", ".Release.Namespace", "Default namespace of the release"),
Expand Down Expand Up @@ -144,7 +144,7 @@ export class FuncMap {
this.f("cat", "cat $str1 $str2 ...", "concatenate all given strings into one, separated by spaces"),
this.f("indent", "indent $count $str", "indent $str with $count space chars on the left"),
this.f("replace", "replace $find $replace $str", "find $find and replace with $replace"),

// String list
this.f("plural", "plural $singular $plural $count", "if $count is 1, return $singular, else return $plural"),
this.f("join", "join $sep $str1 $str2 ...", "concatenate all given strings into one, separated by $sep"),
Expand Down
2 changes: 1 addition & 1 deletion src/helm.resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class Resources {
});
});
return res;
}
}
}

function d(name: string, use: string, doc: string): vscode.CompletionItem {
Expand Down
8 changes: 4 additions & 4 deletions src/kubectlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export async function switchNamespace(kubectl: Kubectl, namespace: string): Prom

/**
* Run the specified image in the kubernetes cluster.
*
*
* @param kubectl the kubectl client.
* @param deploymentName the deployment name.
* @param image the docker image.
Expand Down Expand Up @@ -234,7 +234,7 @@ export async function runAsDeployment(kubectl: Kubectl, deploymentName: string,

/**
* Query the pod list for the specified label.
*
*
* @param kubectl the kubectl client.
* @param labelQuery the query label.
* @return the pod list.
Expand All @@ -253,7 +253,7 @@ export async function findPodsByLabel(kubectl: Kubectl, labelQuery: string): Pro

/**
* Wait and block until the specified pod's status becomes running.
*
*
* @param kubectl the kubectl client.
* @param podName the pod name.
*/
Expand All @@ -273,7 +273,7 @@ export async function waitForRunningPod(kubectl: Kubectl, podName: string): Prom
Pod logs:\n${logsResult.code === 0 ? logsResult.stdout : logsResult.stderr}`);
throw new Error(`Failed to start the pod "${podName}". Its status is "${status}".`);
}

await sleep(1000);
}
}
Expand Down
14 changes: 7 additions & 7 deletions test/kubectl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ suite("kubectl tests", () => {
test("...we do not attempt to call kubectl", async () => {
let kubectlInvoked = false;
const kubectl = kubectlCreateWithFakes({
shell: fakes.shell({execCallback: (cmd) => {
shell: fakes.shell({execCallback: (cmd) => {
if (cmd.startsWith('kubectl')) { kubectlInvoked = true; }
return { code: 98765, stdout: '', stderr: '' };
} })
Expand All @@ -195,7 +195,7 @@ suite("kubectl tests", () => {
const kubectl = kubectlCreateWithFakes({
shell: fakes.shell({
recognisedCommands: [{command: 'where.exe kubectl.exe', code: 0, stdout: 'c:\\kubectl.exe'}],
execCallback: (cmd) => {
execCallback: (cmd) => {
if (cmd.startsWith('kubectl')) { kubectlInvoked = true; }
return { code: 98765, stdout: '', stderr: '' };
}
Expand All @@ -210,7 +210,7 @@ suite("kubectl tests", () => {
const kubectl = kubectlCreateWithFakes({
host: fakes.host({configuration: kcFakePathConfig()}),
shell: fakes.shell({
execCallback: (cmd) => {
execCallback: (cmd) => {
invoked.push(cmd);
return { code: 98765, stdout: '', stderr: '' };
}
Expand All @@ -232,7 +232,7 @@ suite("kubectl tests", () => {
const kubectl = kubectlCreateWithFakes({
shell: fakes.shell({
recognisedCommands: [{command: 'where.exe kubectl.exe', code: 0, stdout: 'c:\\kubectl.exe'}],
execCallback: (cmd) => {
execCallback: (cmd) => {
if (cmd.startsWith('kubectl')) { kubectlCommandLine = cmd; }
return { code: 98765, stdout: '', stderr: '' };
}
Expand All @@ -248,7 +248,7 @@ suite("kubectl tests", () => {
const kubectl = kubectlCreateWithFakes({
shell: fakes.shell({
recognisedCommands: [{command: 'where.exe kubectl.exe', code: 0, stdout: 'c:\\kubectl.exe'}],
execCallback: (cmd) => {
execCallback: (cmd) => {
if (cmd.startsWith('kubectl')) { return fakeKubectlResult; }
return { code: 98765, stdout: '', stderr: '' };
}
Expand All @@ -269,7 +269,7 @@ suite("kubectl tests", () => {
host: fakes.host({errors: errors, warnings: warnings, infos: infos}),
shell: fakes.shell({
recognisedCommands: [{command: 'where.exe kubectl.exe', code: 0, stdout: 'c:\\kubectl.exe'}],
execCallback: (cmd) => {
execCallback: (cmd) => {
if (cmd.startsWith('kubectl')) { return fakeKubectlResult; }
return { code: 98765, stdout: '', stderr: '' };
}
Expand All @@ -291,7 +291,7 @@ suite("kubectl tests", () => {
host: fakes.host({errors: errors, warnings: warnings, infos: infos}),
shell: fakes.shell({
recognisedCommands: [{command: 'where.exe kubectl.exe', code: 0, stdout: 'c:\\kubectl.exe'}],
execCallback: (cmd) => {
execCallback: (cmd) => {
if (cmd.startsWith('kubectl')) { return fakeKubectlResult; }
return { code: 98765, stdout: '', stderr: '' };
}
Expand Down
3 changes: 2 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
]
],
"no-trailing-whitespace": true
}
}

0 comments on commit b8f3e21

Please sign in to comment.