Skip to content

Commit d9518aa

Browse files
authored
test(sonar): setup sonar (#206)
1 parent f2ce18a commit d9518aa

File tree

78 files changed

+365
-326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+365
-326
lines changed

.scannerwork/report-task.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
projectKey=x-backend-replica
2+
serverUrl=http://localhost:9000
3+
serverVersion=25.12.0.117093
4+
dashboardUrl=http://localhost:9000/dashboard?id=x-backend-replica
5+
ceTaskId=7168e6a5-41aa-42a6-a2a2-124c7e9216b7
6+
ceTaskUrl=http://localhost:9000/api/ce/task?id=7168e6a5-41aa-42a6-a2a2-124c7e9216b7

package-lock.json

Lines changed: 198 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"seed": "ts-node -r tsconfig-paths/register src/databases/seeds/scripts/seed.ts",
3131
"es:seed": "ts-node -r tsconfig-paths/register src/elasticsearch/scripts/es-seed.ts",
3232
"es:reset": "ts-node -r tsconfig-paths/register src/elasticsearch/scripts/es-reset.ts",
33-
"generate-encryption-key": "node -r ts-node/register src/shared/services/encryption/generate-encryption-key.ts"
33+
"generate-encryption-key": "node -r ts-node/register src/shared/services/encryption/generate-encryption-key.ts",
34+
"sonar": "npm run test:cov && sonar-scanner"
3435
},
3536
"lint-staged": {
3637
"*.ts": [
@@ -125,6 +126,7 @@
125126
"jest": "^30.0.0",
126127
"lint-staged": "^16.2.4",
127128
"prettier": "^3.4.2",
129+
"sonarqube-scanner": "^4.3.2",
128130
"source-map-support": "^0.5.21",
129131
"supertest": "^7.0.0",
130132
"ts-jest": "^29.2.5",

sonar-project.properties

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SonarQube Configuration
2+
sonar.projectKey=x-backend-replica
3+
sonar.projectName=X Backend Replica
4+
sonar.projectVersion=1.0
5+
6+
# Source code location
7+
sonar.sources=src
8+
sonar.tests=src
9+
sonar.test.inclusions=**/*.spec.ts
10+
11+
# Exclude files from analysis
12+
sonar.exclusions=**/node_modules/**,**/dist/**,**/coverage/**,**/*.spec.ts,**/migrations/**,**/seeds/**,**/databases/**,**/*.swagger.ts
13+
14+
# TypeScript specific settings
15+
sonar.typescript.lcov.reportPaths=coverage/lcov.info
16+
17+
# Encoding
18+
sonar.sourceEncoding=UTF-8
19+
20+
# SonarQube server URL (default local)
21+
sonar.host.url=http://localhost:9000
22+
23+
# Authentication (you'll need to generate a token after SonarQube starts)
24+
sonar.login=squ_3ee91cb3e490cdd73f98c3640cd764b17b18b912

src/app.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ export class AppService {
189189
let replies_count = 0;
190190
for (const reply_data of TestDataConstants.TEST_REPLIES) {
191191
const replier = created_users[reply_data.replier_index];
192-
const original_user = created_users[reply_data.original_user_index];
193192
const original_tweet =
194193
all_tweets[reply_data.original_user_index][reply_data.original_tweet_index];
195194

@@ -396,6 +395,7 @@ export class AppService {
396395
user_identifier: string,
397396
file: Express.Multer.File
398397
): Promise<UploadFileResponseDto> {
398+
//eslint-disable-next-line
399399
if (!file || !file.buffer) {
400400
throw new BadRequestException(ERROR_MESSAGES.FILE_NOT_FOUND);
401401
}

src/auth/auth.controller.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,8 @@ export class AuthController {
406406
@ApiResponse(google_oauth_swagger.responses.success)
407407
@ApiResponse(google_oauth_swagger.responses.InternalServerError)
408408
@Get('google')
409-
googleLogin() {}
409+
// eslint-disable-next-line @typescript-eslint/no-empty-function
410+
googleLogin() {} // Intentionally empty - GoogleAuthGuard handles the OAuth redirect
410411

411412
@ApiOperation(google_mobile_swagger.operation)
412413
@ApiBody({ type: MobileGoogleAuthDto })
@@ -505,7 +506,8 @@ export class AuthController {
505506
@ApiResponse(facebook_oauth_swagger.responses.success)
506507
@ApiResponse(facebook_oauth_swagger.responses.InternalServerError)
507508
@Get('facebook')
508-
facebookLogin() {}
509+
// eslint-disable-next-line @typescript-eslint/no-empty-function
510+
facebookLogin() {} // Intentionally empty - FacebookAuthGuard handles the OAuth redirect
509511

510512
@UseGuards(FacebookAuthGuard)
511513
@ApiOperation(facebook_callback_swagger.operation)
@@ -561,7 +563,8 @@ export class AuthController {
561563
@ApiResponse(github_oauth_swagger.responses.success)
562564
@ApiResponse(github_oauth_swagger.responses.InternalServerError)
563565
@Get('github')
564-
async githubLogin() {}
566+
// eslint-disable-next-line @typescript-eslint/no-empty-function
567+
async githubLogin() {} // Intentionally empty - GitHubAuthGuard handles the OAuth redirect
565568

566569
@ApiOperation(github_mobile_swagger.operation)
567570
@ApiBody({ type: MobileGitHubAuthDto })

0 commit comments

Comments
 (0)