Skip to content

Commit af0b4ec

Browse files
committed
Suppress no-console warnings with TODO comments
Each console.debug/log call is noted as likely redundant and suppressed with eslint-disable-next-line rather than removed, since removal is a behavioral change outside the scope of this tooling PR.
1 parent 2e21b04 commit af0b4ec

4 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/configuration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export const getConfig: () => PackwerkConfig = () => {
1515
const conf = vs.workspace.getConfiguration('ruby.packwerk');
1616
let executable = conf.get('executable', 'bin/packwerk check');
1717

18+
// TODO: likely redundant debug logging; consider removing
19+
// eslint-disable-next-line no-console
1820
console.debug(`[DEBUG] Parsing config, found executable '${executable}'`);
1921

2022
return {

src/outputParser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export function parseOutput(str: string): PackwerkOutput {
1010

1111
let arr: RegExpExecArray;
1212
while ((arr = regex.exec(str)) !== null) {
13+
// TODO: likely redundant debug logging; consider removing
14+
// eslint-disable-next-line no-console
1315
console.log('[DEBUG] Parsed regular expression', arr);
1416
const file = arr[1];
1517
const line = Number(arr[2]);

src/packwerk.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@ export class Packwerk {
4848
let relativeFileName = fileName.replace(currentPath + '/', '');
4949

5050
let onDidExec = (error: Error, stdout: string, stderr: string) => {
51+
// TODO: likely redundant debug logging; consider removing
52+
// eslint-disable-next-line no-console
5153
console.debug('[DEBUG] Finished running command, in onDidExec');
54+
// eslint-disable-next-line no-console
5255
console.debug('[DEBUG] Error, stderr', error, stderr);
5356
this.reportError(error, stderr);
5457
let packwerk = this.parse(stdout);
5558
if (packwerk === undefined || packwerk === null) {
59+
// TODO: likely redundant debug logging; consider removing
60+
// eslint-disable-next-line no-console
5661
console.debug('[DEBUG] packwerk is undefined or null, returning from onDidExec');
5762
return;
5863
}
@@ -76,6 +81,8 @@ export class Packwerk {
7681
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
7782

7883
const message = decolorizedMessage;
84+
// TODO: likely redundant debug logging; consider removing
85+
// eslint-disable-next-line no-console
7986
console.debug('[DEBUG] Adding vscode.Diagnostic:', { range, message });
8087
const diagnostic = new vscode.Diagnostic(
8188
range,
@@ -131,6 +138,8 @@ export class Packwerk {
131138
cb: (err: Error, stdout: string, stderr: string) => void
132139
): cp.ChildProcess {
133140
let command = `${this.config.executable} ${fileName}`;
141+
// TODO: likely redundant debug logging; consider removing
142+
// eslint-disable-next-line no-console
134143
console.debug(`[DEBUG] Running command ${command}`);
135144

136145
let child = cp.exec(command, options, cb);
@@ -142,8 +151,11 @@ export class Packwerk {
142151
private parse(output: string): PackwerkOutput | null {
143152
let packwerk: PackwerkOutput;
144153
if (output.length < 1) {
154+
// TODO: likely redundant debug logging; consider removing
155+
// eslint-disable-next-line no-console
145156
console.debug(`[DEBUG] Output is ${output}`);
146157
let message = `command ${this.config.executable} returns empty output! please check configuration.`;
158+
// eslint-disable-next-line no-console
147159
console.debug(`[DEBUG] ${message}`);
148160
// For now, we do not show this error message. There are lots of reasons why this could fail, so
149161
// we turn it off so as to not bother the user
@@ -176,10 +188,14 @@ export class Packwerk {
176188
);
177189
return true;
178190
} else if (error && (<any>error).code === 127 && this.config.showWarnings) {
191+
// TODO: likely redundant debug logging; consider removing
192+
// eslint-disable-next-line no-console
179193
console.debug('[DEBUG] Showing error with code 127', stderr);
180194
vscode.window.showWarningMessage(stderr);
181195
return true;
182196
} else if (errorOutput.length > 0 && this.config.showWarnings) {
197+
// TODO: likely redundant debug logging; consider removing
198+
// eslint-disable-next-line no-console
183199
console.debug('[DEBUG] Showing error with errorOutput.length > 0', stderr);
184200
vscode.window.showWarningMessage(stderr);
185201
return true;

src/taskQueue.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ export class TaskQueue {
9696
let uriString = uri.toString(true);
9797
this.tasks.forEach((task) => {
9898
if (task.uri.toString(true) === uriString) {
99+
// TODO: likely redundant debug logging; consider removing
100+
// eslint-disable-next-line no-console
99101
console.debug(`[DEBUG] Canceling existing task for ${task.uri}`);
100102
task.cancel();
101103
}

0 commit comments

Comments
 (0)