tech-debt-score 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -14,17 +14,13 @@ export class FileSystemReader implements IFileReader {
|
|
|
14
14
|
// Resolve the root path to absolute
|
|
15
15
|
const absoluteRoot = resolve(rootPath);
|
|
16
16
|
|
|
17
|
-
//
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
// Scan for files matching patterns
|
|
23
|
-
const files = await fg(absolutePatterns, {
|
|
17
|
+
// Scan for files using cwd - this is more robust for glob matching
|
|
18
|
+
const files = await fg(patterns, {
|
|
19
|
+
cwd: absoluteRoot,
|
|
24
20
|
ignore,
|
|
25
21
|
absolute: true,
|
|
26
22
|
onlyFiles: true,
|
|
27
|
-
dot: false,
|
|
23
|
+
dot: false,
|
|
28
24
|
});
|
|
29
25
|
|
|
30
26
|
return files;
|
|
@@ -38,7 +38,7 @@ export interface AnalysisConfig {
|
|
|
38
38
|
* Default configuration values
|
|
39
39
|
*/
|
|
40
40
|
export const DEFAULT_CONFIG: Omit<AnalysisConfig, 'rootPath'> = {
|
|
41
|
-
patterns: ['src/**/*.ts', 'src/**/*.js'],
|
|
41
|
+
patterns: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.js', 'src/**/*.jsx'],
|
|
42
42
|
ignore: ['node_modules', 'dist', 'build', 'coverage', '.git'],
|
|
43
43
|
weights: {
|
|
44
44
|
complexity: 0.30,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
2
3
|
import { AnalysisService } from '../../application/services/AnalysisService.js';
|
|
3
4
|
import { FileSystemReader } from '../../adapters/input/FileSystemReader.js';
|
|
4
5
|
import { TypeScriptParser } from '../../adapters/input/TypeScriptParser.js';
|
|
@@ -52,16 +53,25 @@ export async function analyzeCommand(rootPath: string, jsonOutputPath?: string):
|
|
|
52
53
|
rules,
|
|
53
54
|
reporter
|
|
54
55
|
);
|
|
55
|
-
|
|
56
|
+
|
|
56
57
|
// Build configuration
|
|
57
58
|
// Smart pattern detection:
|
|
58
|
-
// - If scanning
|
|
59
|
-
// - If scanning
|
|
59
|
+
// - If scanning a specific directory (e.g. ./lib), look for files inside it
|
|
60
|
+
// - If scanning CWD:
|
|
61
|
+
// - If 'src' folder exists, use 'src/**/*.ts'
|
|
62
|
+
// - Otherwise, scan all files in root '**/*.ts'
|
|
60
63
|
const isCwd = resolve(rootPath) === process.cwd();
|
|
64
|
+
const hasSrcFolder = existsSync(resolve(rootPath, 'src'));
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
let defaultPatterns: string[];
|
|
67
|
+
|
|
68
|
+
if (!isCwd) {
|
|
69
|
+
defaultPatterns = ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'];
|
|
70
|
+
} else if (hasSrcFolder) {
|
|
71
|
+
defaultPatterns = DEFAULT_CONFIG.patterns; // ['src/**/*.ts', 'src/**/*.js']
|
|
72
|
+
} else {
|
|
73
|
+
defaultPatterns = ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'];
|
|
74
|
+
}
|
|
65
75
|
|
|
66
76
|
const config: AnalysisConfig = {
|
|
67
77
|
rootPath,
|