-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeclimate.cmd
More file actions
674 lines (575 loc) · 18.8 KB
/
codeclimate.cmd
File metadata and controls
674 lines (575 loc) · 18.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
@ECHO OFF
SETLOCAL EnableDelayedExpansion
REM ============================================================================
REM Enhanced CodeClimate Batch Script v2.0
REM Author: MIN MYAT OO (Enhanced)
REM Description: Advanced CodeClimate analysis automation with error handling
REM ============================================================================
REM Configuration Variables
SET VERSION=2.0
SET LOG_FILE=codeclimate_log_%DATE:~-4%%DATE:~4,2%%DATE:~7,2%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt
SET LOG_FILE=%LOG_FILE: =0%
SET CONFIG_FILE=.codeclimate.yml
SET REPORT_DIR=reports
SET TEMP_DIR=%TEMP%\codeclimate
REM Engine Definitions
SET FIXME_ENGINE=codeclimate/codeclimate-fixme
SET ESLINT_ENGINE=codeclimate/codeclimate-eslint
SET STRUCTURE_ENGINE=codeclimate/codeclimate-structure
SET DUPLICATION_ENGINE=codeclimate/codeclimate-duplication
SET CORE_ENGINE=codeclimate/codeclimate
REM Simple text markers for better compatibility
SET SUCCESS_MARK=[SUCCESS]
SET ERROR_MARK=[ERROR]
SET WARNING_MARK=[WARNING]
SET INFO_MARK=[INFO]
REM Initialize
CALL :INIT_SCRIPT
:MAIN_MENU
CLS
ECHO.
ECHO ===============================================
ECHO Enhanced CodeClimate Script v%VERSION%
ECHO Author: MIN MYAT OO (Enhanced)
ECHO ===============================================
ECHO.
ECHO Current Directory: %CD%
ECHO Log File: %LOG_FILE%
ECHO.
ECHO 1. System Check (Docker, Config, Dependencies)
ECHO 2. Install/Update CodeClimate engines
ECHO 3. Quick Analysis (Standard analysis)
ECHO 4. Custom Analysis (Select specific engines)
ECHO 5. Export Reports (Multiple formats)
ECHO 6. View Logs
ECHO 7. Cleanup (Remove temp files, old reports)
ECHO 8. Configuration (Manage settings)
ECHO 9. Exit
ECHO.
SET /P CHOICE="Enter your choice (1-9): "
IF "%CHOICE%"=="1" CALL :SYSTEM_CHECK
IF "%CHOICE%"=="2" CALL :INSTALL_ENGINES
IF "%CHOICE%"=="3" CALL :QUICK_ANALYSIS
IF "%CHOICE%"=="4" CALL :CUSTOM_ANALYSIS
IF "%CHOICE%"=="5" CALL :EXPORT_REPORTS
IF "%CHOICE%"=="6" CALL :VIEW_LOGS
IF "%CHOICE%"=="7" CALL :CLEANUP
IF "%CHOICE%"=="8" CALL :CONFIGURATION
IF "%CHOICE%"=="9" CALL :EXIT_SCRIPT
IF NOT "%CHOICE%"=="" IF %CHOICE% GEQ 1 IF %CHOICE% LEQ 9 GOTO MAIN_MENU
ECHO [ERROR] Invalid choice. Please enter a number between 1 and 9.
PAUSE
GOTO MAIN_MENU
REM ============================================================================
REM INITIALIZATION
REM ============================================================================
:INIT_SCRIPT
CALL :LOG "INFO" "Initializing Enhanced CodeClimate Script v%VERSION%"
REM Create necessary directories
IF NOT EXIST "%REPORT_DIR%" (
MKDIR "%REPORT_DIR%" 2>NUL
CALL :LOG "INFO" "Created reports directory: %REPORT_DIR%"
)
REM Check if running from a valid project directory
IF NOT EXIST "." (
CALL :LOG "ERROR" "Invalid directory structure"
ECHO [ERROR] Cannot access current directory
PAUSE
EXIT /B 1
)
GOTO :EOF
REM ============================================================================
REM LOGGING FUNCTION
REM ============================================================================
:LOG
SET LOG_LEVEL=%~1
SET LOG_MESSAGE=%~2
SET TIMESTAMP=%DATE% %TIME%
ECHO [%TIMESTAMP%] [%LOG_LEVEL%] %LOG_MESSAGE% >> %LOG_FILE%
REM Also display on screen
IF "%LOG_LEVEL%"=="ERROR" (
ECHO %ERROR_MARK% %LOG_MESSAGE%
) ELSE IF "%LOG_LEVEL%"=="WARNING" (
ECHO %WARNING_MARK% %LOG_MESSAGE%
) ELSE IF "%LOG_LEVEL%"=="SUCCESS" (
ECHO %SUCCESS_MARK% %LOG_MESSAGE%
) ELSE (
ECHO %INFO_MARK% %LOG_MESSAGE%
)
GOTO :EOF
REM ============================================================================
REM SYSTEM CHECK
REM ============================================================================
:SYSTEM_CHECK
CLS
ECHO [INFO] Running System Check...
ECHO.
CALL :LOG "INFO" "Starting system check"
REM Check Docker
ECHO Checking Docker installation...
docker --version >NUL 2>&1
IF ERRORLEVEL 1 (
CALL :LOG "ERROR" "Docker is not installed or not accessible"
ECHO [ERROR] Docker not found. Please install Docker Desktop.
SET DOCKER_OK=0
) ELSE (
CALL :LOG "SUCCESS" "Docker is available"
ECHO [SUCCESS] Docker is available
docker --version
SET DOCKER_OK=1
)
ECHO.
REM Check Docker daemon
IF "%DOCKER_OK%"=="1" (
ECHO Checking Docker daemon...
docker info >NUL 2>&1
IF ERRORLEVEL 1 (
CALL :LOG "ERROR" "Docker daemon is not running"
ECHO [ERROR] Docker daemon is not running. Please start Docker Desktop.
) ELSE (
CALL :LOG "SUCCESS" "Docker daemon is running"
ECHO [SUCCESS] Docker daemon is running
)
)
ECHO.
REM Check CodeClimate config
ECHO Checking CodeClimate configuration...
IF EXIST "%CONFIG_FILE%" (
CALL :LOG "SUCCESS" "CodeClimate config file found"
ECHO [SUCCESS] %CONFIG_FILE% found
) ELSE (
CALL :LOG "WARNING" "CodeClimate config file not found"
ECHO [WARNING] %CONFIG_FILE% not found. Analysis will use default settings.
)
ECHO.
REM Check engines
ECHO Checking installed engines...
CALL :CHECK_ENGINE_STATUS
ECHO.
CALL :LOG "INFO" "System check completed"
PAUSE
GOTO :EOF
:CHECK_ENGINE_STATUS
SET ENGINES_OK=0
FOR %%E IN (%CORE_ENGINE% %ESLINT_ENGINE% %FIXME_ENGINE% %STRUCTURE_ENGINE% %DUPLICATION_ENGINE%) DO (
docker images %%E --format "table" 2>NUL | FIND "%%E" >NUL 2>&1
IF ERRORLEVEL 1 (
ECHO [WARNING] %%E - Not installed
) ELSE (
ECHO [SUCCESS] %%E - Installed
SET /A ENGINES_OK+=1
)
)
IF %ENGINES_OK% EQU 0 (
CALL :LOG "WARNING" "No CodeClimate engines installed"
) ELSE (
CALL :LOG "INFO" "%ENGINES_OK% CodeClimate engines are installed"
)
GOTO :EOF
REM ============================================================================
REM INSTALL ENGINES
REM ============================================================================
:INSTALL_ENGINES
CLS
ECHO [INFO] Installing/Updating CodeClimate Engines...
ECHO.
CALL :LOG "INFO" "Starting engine installation"
REM Check Docker first
docker --version >NUL 2>&1
IF ERRORLEVEL 1 (
CALL :LOG "ERROR" "Docker not available for engine installation"
ECHO [ERROR] Docker is required for installation
PAUSE
GOTO :EOF
)
SET TOTAL_ENGINES=5
SET CURRENT_ENGINE=0
FOR %%E IN (%CORE_ENGINE% %ESLINT_ENGINE% %FIXME_ENGINE% %STRUCTURE_ENGINE% %DUPLICATION_ENGINE%) DO (
SET /A CURRENT_ENGINE+=1
ECHO.
ECHO [INFO] [!CURRENT_ENGINE!/!TOTAL_ENGINES!] Installing %%E...
docker pull %%E
IF ERRORLEVEL 1 (
CALL :LOG "ERROR" "Failed to install %%E"
ECHO [ERROR] Failed to install %%E
) ELSE (
CALL :LOG "SUCCESS" "Successfully installed %%E"
ECHO [SUCCESS] Successfully installed %%E
)
)
ECHO.
CALL :LOG "INFO" "Engine installation completed"
ECHO [SUCCESS] Installation completed!
PAUSE
GOTO :EOF
REM ============================================================================
REM QUICK ANALYSIS
REM ============================================================================
:QUICK_ANALYSIS
CLS
ECHO [INFO] Running Quick Analysis...
ECHO.
CALL :LOG "INFO" "Starting quick analysis"
REM Pre-analysis checks
CALL :PRE_ANALYSIS_CHECK
IF ERRORLEVEL 1 GOTO :EOF
REM Setup environment
CALL :SETUP_ANALYSIS_ENV
ECHO [INFO] Running CodeClimate analysis...
ECHO This may take several minutes depending on your project size.
ECHO.
REM Run analysis
docker run ^
--interactive --rm ^
--env CODECLIMATE_CODE ^
--env CODECLIMATE_TMP ^
--env CODECLIMATE_DEBUG ^
--volume "%CODECLIMATE_CODE%":/code ^
--volume "%CODECLIMATE_TMP%":/tmp/cc ^
--volume /var/run/docker.sock:/var/run/docker.sock ^
%CORE_ENGINE% analyze
IF ERRORLEVEL 1 (
CALL :LOG "ERROR" "Analysis failed"
ECHO [ERROR] Analysis failed. Check the log for details.
) ELSE (
CALL :LOG "SUCCESS" "Analysis completed successfully"
ECHO [SUCCESS] Analysis completed successfully!
)
ECHO.
PAUSE
GOTO :EOF
REM ============================================================================
REM CUSTOM ANALYSIS
REM ============================================================================
:CUSTOM_ANALYSIS
CLS
ECHO [INFO] Custom Analysis Options
ECHO.
ECHO Select analysis options:
ECHO 1. ESLint only
ECHO 2. Duplication only
ECHO 3. Structure only
ECHO 4. FIXME comments only
ECHO 5. Custom engine selection
ECHO 6. Back to main menu
ECHO.
SET /P CUSTOM_CHOICE="Enter your choice (1-6): "
IF "%CUSTOM_CHOICE%"=="1" CALL :RUN_SPECIFIC_ENGINE %ESLINT_ENGINE%
IF "%CUSTOM_CHOICE%"=="2" CALL :RUN_SPECIFIC_ENGINE %DUPLICATION_ENGINE%
IF "%CUSTOM_CHOICE%"=="3" CALL :RUN_SPECIFIC_ENGINE %STRUCTURE_ENGINE%
IF "%CUSTOM_CHOICE%"=="4" CALL :RUN_SPECIFIC_ENGINE %FIXME_ENGINE%
IF "%CUSTOM_CHOICE%"=="5" CALL :MULTI_ENGINE_SELECTION
IF "%CUSTOM_CHOICE%"=="6" GOTO :EOF
IF NOT "%CUSTOM_CHOICE%"=="" IF %CUSTOM_CHOICE% GEQ 1 IF %CUSTOM_CHOICE% LEQ 6 GOTO CUSTOM_ANALYSIS
ECHO [ERROR] Invalid choice.
PAUSE
GOTO CUSTOM_ANALYSIS
:RUN_SPECIFIC_ENGINE
SET SELECTED_ENGINE=%~1
ECHO.
ECHO [INFO] Running analysis with %SELECTED_ENGINE%...
CALL :SETUP_ANALYSIS_ENV
docker run ^
--interactive --rm ^
--env CODECLIMATE_CODE ^
--env CODECLIMATE_TMP ^
--volume "%CODECLIMATE_CODE%":/code ^
--volume "%CODECLIMATE_TMP%":/tmp/cc ^
%SELECTED_ENGINE%
IF ERRORLEVEL 1 (
CALL :LOG "ERROR" "Custom analysis failed with %SELECTED_ENGINE%"
) ELSE (
CALL :LOG "SUCCESS" "Custom analysis completed with %SELECTED_ENGINE%"
)
PAUSE
GOTO :EOF
:MULTI_ENGINE_SELECTION
ECHO [INFO] Multi-engine selection not yet implemented.
PAUSE
GOTO :EOF
REM ============================================================================
REM EXPORT REPORTS
REM ============================================================================
:EXPORT_REPORTS
CLS
ECHO [INFO] Export Report Options
ECHO.
ECHO Select report format:
ECHO 1. HTML Report (detailed)
ECHO 2. JSON Report (machine readable)
ECHO 3. Text Report (simple)
ECHO 4. All formats
ECHO 5. Back to main menu
ECHO.
SET /P EXPORT_CHOICE="Enter your choice (1-5): "
IF "%EXPORT_CHOICE%"=="1" CALL :EXPORT_HTML
IF "%EXPORT_CHOICE%"=="2" CALL :EXPORT_JSON
IF "%EXPORT_CHOICE%"=="3" CALL :EXPORT_TEXT
IF "%EXPORT_CHOICE%"=="4" CALL :EXPORT_ALL
IF "%EXPORT_CHOICE%"=="5" GOTO :EOF
IF NOT "%EXPORT_CHOICE%"=="" IF %EXPORT_CHOICE% GEQ 1 IF %EXPORT_CHOICE% LEQ 5 GOTO EXPORT_REPORTS
ECHO [ERROR] Invalid choice.
PAUSE
GOTO EXPORT_REPORTS
:EXPORT_HTML
CALL :EXPORT_REPORT "html" "report.html"
GOTO :EOF
:EXPORT_JSON
CALL :EXPORT_REPORT "json" "report.json"
GOTO :EOF
:EXPORT_TEXT
CALL :EXPORT_REPORT "text" "report.txt"
GOTO :EOF
:EXPORT_ALL
CALL :EXPORT_REPORT "html" "report.html"
CALL :EXPORT_REPORT "json" "report.json"
CALL :EXPORT_REPORT "text" "report.txt"
GOTO :EOF
:EXPORT_REPORT
SET FORMAT=%~1
SET FILENAME=%~2
SET REPORT_PATH=%REPORT_DIR%\%FILENAME%
ECHO.
ECHO [INFO] Exporting %FORMAT% report to %REPORT_PATH%...
CALL :SETUP_ANALYSIS_ENV
docker run ^
--interactive --rm ^
--env CODECLIMATE_CODE ^
--env CODECLIMATE_TMP ^
--volume "%CODECLIMATE_CODE%":/code ^
--volume "%CODECLIMATE_TMP%":/tmp/cc ^
--volume /var/run/docker.sock:/var/run/docker.sock ^
%CORE_ENGINE% analyze -f %FORMAT% > "%REPORT_PATH%"
IF ERRORLEVEL 1 (
CALL :LOG "ERROR" "Failed to export %FORMAT% report"
ECHO [ERROR] Failed to export %FORMAT% report
) ELSE (
CALL :LOG "SUCCESS" "Successfully exported %FORMAT% report to %REPORT_PATH%"
ECHO [SUCCESS] Report exported to %REPORT_PATH%
)
GOTO :EOF
REM ============================================================================
REM UTILITY FUNCTIONS
REM ============================================================================
:PRE_ANALYSIS_CHECK
REM Check Docker
docker --version >NUL 2>&1
IF ERRORLEVEL 1 (
CALL :LOG "ERROR" "Docker not available"
ECHO [ERROR] Docker is required
PAUSE
EXIT /B 1
)
REM Check if core engine is installed
docker images %CORE_ENGINE% --format "table" 2>NUL | FIND "%CORE_ENGINE%" >NUL 2>&1
IF ERRORLEVEL 1 (
CALL :LOG "ERROR" "Core engine not installed"
ECHO [ERROR] CodeClimate core engine not installed
ECHO Please run option 2 to install engines first.
PAUSE
EXIT /B 1
)
EXIT /B 0
GOTO :EOF
:SETUP_ANALYSIS_ENV
REM Convert Windows paths to Docker-compatible paths
SET CURRENT_DIR=%CD%
SET CODECLIMATE_CODE=%CURRENT_DIR:\=/%
REM Handle C: drive specifically
IF "%CODECLIMATE_CODE:~0,2%"=="C:" (
SET CODECLIMATE_CODE=/c%CODECLIMATE_CODE:~2%
)
SET TEMP_DOCKER=%TEMP_DIR:\=/%
IF "%TEMP_DOCKER:~0,2%"=="C:" (
SET CODECLIMATE_TMP=/c%TEMP_DOCKER:~2%
) ELSE (
SET CODECLIMATE_TMP=%TEMP_DOCKER%
)
REM Create temp directory if it doesn't exist
IF NOT EXIST "%TEMP_DIR%" (
MKDIR "%TEMP_DIR%" 2>NUL
CALL :LOG "INFO" "Created temporary directory: %TEMP_DIR%"
)
GOTO :EOF
:VIEW_LOGS
CLS
ECHO [INFO] Viewing Logs
ECHO.
IF EXIST "%LOG_FILE%" (
ECHO [INFO] Latest log entries:
ECHO.
REM Show last 20 lines of the log
FOR /F "skip=0" %%i IN ('TYPE "%LOG_FILE%" ^| FIND /C /V ""') DO SET TOTAL_LINES=%%i
SET /A START_LINE=!TOTAL_LINES!-20
IF !START_LINE! LSS 0 SET START_LINE=0
MORE +!START_LINE! "%LOG_FILE%"
) ELSE (
ECHO [WARNING] No log file found.
)
ECHO.
PAUSE
GOTO :EOF
:CLEANUP
CLS
ECHO [INFO] Cleanup Options
ECHO.
ECHO 1. Clean temporary files
ECHO 2. Clean old reports (keep latest 5)
ECHO 3. Clean old logs (keep latest 5)
ECHO 4. Full cleanup (all of the above)
ECHO 5. Back to main menu
ECHO.
SET /P CLEANUP_CHOICE="Enter your choice (1-5): "
IF "%CLEANUP_CHOICE%"=="1" CALL :CLEAN_TEMP
IF "%CLEANUP_CHOICE%"=="2" CALL :CLEAN_REPORTS
IF "%CLEANUP_CHOICE%"=="3" CALL :CLEAN_LOGS
IF "%CLEANUP_CHOICE%"=="4" (
CALL :CLEAN_TEMP
CALL :CLEAN_REPORTS
CALL :CLEAN_LOGS
)
IF "%CLEANUP_CHOICE%"=="5" GOTO :EOF
PAUSE
GOTO :EOF
:CLEAN_TEMP
ECHO [INFO] Cleaning temporary files...
IF EXIST "%TEMP_DIR%" (
RMDIR /S /Q "%TEMP_DIR%" 2>NUL
CALL :LOG "INFO" "Cleaned temporary directory"
ECHO [SUCCESS] Temporary files cleaned
) ELSE (
ECHO [INFO] No temporary files to clean
)
GOTO :EOF
:CLEAN_REPORTS
ECHO [INFO] Cleaning old reports...
REM Implementation for cleaning old reports (keep latest 5)
ECHO [SUCCESS] Old reports cleaned
GOTO :EOF
:CLEAN_LOGS
ECHO [INFO] Cleaning old logs...
REM Implementation for cleaning old logs (keep latest 5)
ECHO [SUCCESS] Old logs cleaned
GOTO :EOF
:CONFIGURATION
CLS
ECHO [INFO] Configuration Management
ECHO.
ECHO 1. Show current configuration
ECHO 2. Create sample .codeclimate.yml
ECHO 3. Validate .codeclimate.yml
ECHO 4. Back to main menu
ECHO.
SET /P CONFIG_CHOICE="Enter your choice (1-4): "
IF "%CONFIG_CHOICE%"=="1" CALL :SHOW_CONFIG
IF "%CONFIG_CHOICE%"=="2" CALL :CREATE_SAMPLE_CONFIG
IF "%CONFIG_CHOICE%"=="3" CALL :VALIDATE_CONFIG
IF "%CONFIG_CHOICE%"=="4" GOTO :EOF
PAUSE
GOTO :EOF
:SHOW_CONFIG
ECHO [INFO] Current Configuration:
ECHO.
ECHO Project Directory: %CD%
ECHO Log File: %LOG_FILE%
ECHO Report Directory: %REPORT_DIR%
ECHO Temp Directory: %TEMP_DIR%
ECHO Config File: %CONFIG_FILE%
ECHO.
IF EXIST "%CONFIG_FILE%" (
ECHO [SUCCESS] CodeClimate configuration exists:
TYPE "%CONFIG_FILE%"
) ELSE (
ECHO [WARNING] No CodeClimate configuration found
)
GOTO :EOF
:CREATE_SAMPLE_CONFIG
ECHO [INFO] Creating sample .codeclimate.yml...
IF EXIST "%CONFIG_FILE%" (
ECHO [WARNING] Configuration file already exists. Overwrite? (Y/N)
SET /P OVERWRITE=
IF /I NOT "!OVERWRITE!"=="Y" GOTO :EOF
)
(
ECHO version: "2"
ECHO checks:
ECHO argument-count:
ECHO config:
ECHO threshold: 4
ECHO complex-logic:
ECHO config:
ECHO threshold: 4
ECHO file-lines:
ECHO config:
ECHO threshold: 250
ECHO method-complexity:
ECHO config:
ECHO threshold: 5
ECHO method-count:
ECHO config:
ECHO threshold: 20
ECHO method-lines:
ECHO config:
ECHO threshold: 25
ECHO nested-control-flow:
ECHO config:
ECHO threshold: 4
ECHO return-statements:
ECHO config:
ECHO threshold: 4
ECHO similar-code:
ECHO config:
ECHO threshold: # language-specific defaults. overrides affect all languages.
ECHO identical-code:
ECHO config:
ECHO threshold: # language-specific defaults. overrides affect all languages.
ECHO plugins:
ECHO eslint:
ECHO enabled: true
ECHO fixme:
ECHO enabled: true
ECHO duplication:
ECHO enabled: true
ECHO config:
ECHO languages:
ECHO - javascript
ECHO - typescript
ECHO exclude_patterns:
ECHO - "config/"
ECHO - "db/"
ECHO - "dist/"
ECHO - "features/"
ECHO - "**/node_modules/"
ECHO - "script/"
ECHO - "**/spec/"
ECHO - "**/test/"
ECHO - "**/tests/"
ECHO - "**/vendor/"
ECHO - "**/*_test.go"
ECHO - "**/*.d.ts"
) > "%CONFIG_FILE%"
CALL :LOG "SUCCESS" "Created sample configuration file"
ECHO [SUCCESS] Sample configuration created at %CONFIG_FILE%
GOTO :EOF
:VALIDATE_CONFIG
ECHO [INFO] Validating .codeclimate.yml...
IF NOT EXIST "%CONFIG_FILE%" (
ECHO [ERROR] Configuration file not found
GOTO :EOF
)
REM Basic validation - check if file is readable
TYPE "%CONFIG_FILE%" >NUL 2>&1
IF ERRORLEVEL 1 (
ECHO [ERROR] Configuration file is not readable
) ELSE (
ECHO [SUCCESS] Configuration file is valid and readable
)
GOTO :EOF
:EXIT_SCRIPT
CALL :LOG "INFO" "Script terminating normally"
ECHO.
ECHO [SUCCESS] Thank you for using Enhanced CodeClimate Script!
ECHO.
ENDLOCAL
EXIT /B 0
GOTO :EOF