Skip to content

Commit 2c345a0

Browse files
CLI-31 Auto fix linting issues including headers
1 parent 37e3237 commit 2c345a0

File tree

16 files changed

+103
-50
lines changed

16 files changed

+103
-50
lines changed

src/bootstrap/auth.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export function getSuccessHTML(): string {
173173
* Skipped when CI=true — token must be delivered directly to the loopback server.
174174
*/
175175
export async function openBrowserWithFallback(authURL: string): Promise<void> {
176-
if (process.env['CI'] === 'true') {
176+
if (process.env.CI === 'true') {
177177
return;
178178
}
179179
try {
@@ -263,7 +263,7 @@ async function waitForTokenInteractive(serverTokenPromise: Promise<string>): Pro
263263
else resolve(token!);
264264
}
265265

266-
serverTokenPromise.then(token => settle(token)).catch(() => {});
266+
serverTokenPromise.then(token => { settle(token); }).catch(() => {});
267267

268268
const prompt = new TextPrompt({
269269
signal: promptAbort.signal,
@@ -283,9 +283,9 @@ async function waitForTokenInteractive(serverTokenPromise: Promise<string>): Pro
283283
settle(undefined, new Error('Authentication cancelled'));
284284
return;
285285
}
286-
const userToken = (result as string).trim();
286+
const userToken = (result!).trim();
287287
if (userToken.length > 0) settle(userToken);
288-
}).catch((err: unknown) => settle(undefined, err as Error));
288+
}).catch((err: unknown) => { settle(undefined, err as Error); });
289289
});
290290
}
291291

@@ -323,7 +323,7 @@ export async function generateTokenViaBrowser(
323323

324324
let token: string | undefined;
325325
try {
326-
if (isMockActive() || process.env['CI'] === 'true') {
326+
if (isMockActive() || process.env.CI === 'true') {
327327
// Non-interactive: wait for server token
328328
token = await tokenPromise;
329329
} else {

src/bootstrap/health.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function runHealthChecks(
5858
projectKey: string,
5959
projectRoot: string,
6060
organization?: string,
61-
verbose: boolean = true
61+
verbose = true
6262
): Promise<HealthCheckResult> {
6363
const client = new SonarQubeClient(serverURL, token);
6464
const errors: string[] = [];

src/bootstrap/hooks.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ interface HookConfig {
4545
}
4646

4747
interface ClaudeSettings {
48-
hooks?: {
49-
[eventType: string]: HookConfig[];
50-
};
48+
hooks?: Record<string, HookConfig[]>;
5149
[key: string]: unknown;
5250
}
5351

src/commands/analyze.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1-
// Analyze command - scan for hardcoded secrets
2-
1+
/*
2+
* SonarQube CLI
3+
* Copyright (C) 2026 SonarSource Sàrl
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
320
import { secretCheckCommand } from './secret-scan.js';
421

522
export async function analyzeSecretsCommand(options: {

src/commands/projects.ts

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1-
// Projects command - search for SonarQube projects
2-
1+
/*
2+
* SonarQube CLI
3+
* Copyright (C) 2026 SonarSource Sàrl
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
320
import { SonarQubeClient } from '../sonarqube/client.js';
421
import { ProjectsClient, MAX_PAGE_SIZE } from '../sonarqube/projects.js';
522
import { getToken } from '../lib/keychain.js';
@@ -30,7 +47,9 @@ export async function projectsSearchCommand(options: ProjectsSearchOptions): Pro
3047

3148
const pageSize = options.pageSize ?? MAX_PAGE_SIZE;
3249
if (pageSize <= 0 || pageSize > MAX_PAGE_SIZE) {
33-
throw new Error(`--page-size must be greater than 0 and less than or equal to ${MAX_PAGE_SIZE}`);
50+
throw new Error(
51+
`--page-size must be greater than 0 and less than or equal to ${MAX_PAGE_SIZE}`,
52+
);
3453
}
3554

3655
const client = new SonarQubeClient(activeConnection.serverUrl, token);
@@ -40,18 +59,20 @@ export async function projectsSearchCommand(options: ProjectsSearchOptions): Pro
4059
q: options.query,
4160
ps: pageSize,
4261
p: options.page ?? 1,
43-
organization: activeConnection.orgKey
62+
organization: activeConnection.orgKey,
4463
});
4564

46-
const hasNextPage = (result.paging.pageIndex * result.paging.pageSize) < result.paging.total;
47-
48-
print(JSON.stringify({
49-
projects: result.components.map(c => ({ key: c.key, name: c.name })),
50-
paging: {
51-
pageIndex: result.paging.pageIndex,
52-
pageSize: result.paging.pageSize,
53-
total: result.paging.total,
54-
hasNextPage
55-
}
56-
}));
65+
const hasNextPage = result.paging.pageIndex * result.paging.pageSize < result.paging.total;
66+
67+
print(
68+
JSON.stringify({
69+
projects: result.components.map((c) => ({ key: c.key, name: c.name })),
70+
paging: {
71+
pageIndex: result.paging.pageIndex,
72+
pageSize: result.paging.pageSize,
73+
total: result.paging.total,
74+
hasNextPage,
75+
},
76+
}),
77+
);
5778
}

src/commands/secret-scan.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ async function runScan(
201201
}),
202202
new Promise<never>((_resolve, reject) =>
203203
setTimeout(
204-
() => reject(new Error(`Scan timed out after ${SCAN_TIMEOUT_MS}ms`)),
204+
() => { reject(new Error(`Scan timed out after ${SCAN_TIMEOUT_MS}ms`)); },
205205
SCAN_TIMEOUT_MS
206206
)
207207
)
@@ -235,7 +235,7 @@ async function runScanFromStdin(
235235
}),
236236
new Promise<never>((_resolve, reject) =>
237237
setTimeout(
238-
() => reject(new Error(`Scan timed out after ${SCAN_TIMEOUT_MS}ms`)),
238+
() => { reject(new Error(`Scan timed out after ${SCAN_TIMEOUT_MS}ms`)); },
239239
SCAN_TIMEOUT_MS
240240
)
241241
)
@@ -269,7 +269,7 @@ async function readStdin(): Promise<string> {
269269
}),
270270
new Promise<never>((_resolve, reject) =>
271271
setTimeout(
272-
() => reject(new Error(`stdin read timeout after ${STDIN_READ_TIMEOUT_MS}ms`)),
272+
() => { reject(new Error(`stdin read timeout after ${STDIN_READ_TIMEOUT_MS}ms`)); },
273273
STDIN_READ_TIMEOUT_MS
274274
)
275275
)

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ list
113113
.option('-p, --page <page>', 'Page number', '1')
114114
.option('--page-size <page-size>', 'Page size (1-500)', '500')
115115
.action(async (options) => {
116-
await runCommand(async () => await projectsSearchCommand(options));
116+
await runCommand(async () => { await projectsSearchCommand(options); });
117117
});
118118

119119
// Manage authentication tokens and credentials

src/lib/config-constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const APP_NAME = 'sonarqube-cli';
3939
// ---------------------------------------------------------------------------
4040

4141
/** Root directory for all CLI data: ~/.sonar/sonarqube-cli (override via SONAR_CLI_DIR env var in test environment) */
42-
export const CLI_DIR = process.env.SONAR_CLI_DIR ?? join(homedir(), '.sonar', `${APP_NAME}`);
42+
export const CLI_DIR = process.env.SONAR_CLI_DIR ?? join(homedir(), '.sonar', APP_NAME);
4343

4444
// ---------------------------------------------------------------------------
4545
// State

src/lib/keychain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function clearTokenCache(): void {
4949
}
5050

5151
async function getKeytar() {
52-
if (process.env['SONAR_CLI_DISABLE_KEYCHAIN'] === 'true') {
52+
if (process.env.SONAR_CLI_DISABLE_KEYCHAIN === 'true') {
5353
return noOpKeytar;
5454
}
5555
try {

src/lib/loopback-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
// Loopback HTTP server with security headers and DNS rebinding protection
2222

23-
import { createServer, IncomingMessage, ServerResponse } from 'node:http';
23+
import { createServer, type IncomingMessage, type ServerResponse } from 'node:http';
2424
import logger from './logger.js';
2525
import { AUTH_PORT_START, AUTH_PORT_COUNT } from './config-constants.js';
2626

0 commit comments

Comments
 (0)