tech-debt-score 0.1.1 → 0.1.4
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,8 +38,16 @@ export interface AnalysisConfig {
|
|
|
38
38
|
* Default configuration values
|
|
39
39
|
*/
|
|
40
40
|
export const DEFAULT_CONFIG: Omit<AnalysisConfig, 'rootPath'> = {
|
|
41
|
-
patterns: ['
|
|
42
|
-
ignore: [
|
|
41
|
+
patterns: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
|
42
|
+
ignore: [
|
|
43
|
+
'**/node_modules/**',
|
|
44
|
+
'**/dist/**',
|
|
45
|
+
'**/build/**',
|
|
46
|
+
'**/coverage/**',
|
|
47
|
+
'**/.git/**',
|
|
48
|
+
'**/.next/**',
|
|
49
|
+
'**/out/**',
|
|
50
|
+
],
|
|
43
51
|
weights: {
|
|
44
52
|
complexity: 0.30,
|
|
45
53
|
size: 0.25,
|
|
@@ -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,11 @@ export async function analyzeCommand(rootPath: string, jsonOutputPath?: string):
|
|
|
52
53
|
rules,
|
|
53
54
|
reporter
|
|
54
55
|
);
|
|
55
|
-
|
|
56
|
-
// Build configuration
|
|
57
|
-
// Smart pattern detection:
|
|
58
|
-
// - If scanning CWD, default to looking in 'src/'
|
|
59
|
-
// - If scanning a specific directory (e.g. ./src), look for files inside it
|
|
60
|
-
const isCwd = resolve(rootPath) === process.cwd();
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
// Build configuration
|
|
58
|
+
// Use broad patterns by default and rely on ignore list for exclusions.
|
|
59
|
+
// This makes the tool structure-agnostic (works for src/, lib/, or root files).
|
|
60
|
+
const defaultPatterns = ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'];
|
|
65
61
|
|
|
66
62
|
const config: AnalysisConfig = {
|
|
67
63
|
rootPath,
|
|
@@ -69,6 +65,11 @@ export async function analyzeCommand(rootPath: string, jsonOutputPath?: string):
|
|
|
69
65
|
patterns: defaultPatterns,
|
|
70
66
|
};
|
|
71
67
|
|
|
68
|
+
// Log scan start for transparency
|
|
69
|
+
if (config.patterns.length > 0) {
|
|
70
|
+
console.log(`📂 Scanning for patterns: ${config.patterns.join(', ')}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
72
73
|
// Execute analysis
|
|
73
74
|
await analysisService.analyze(config);
|
|
74
75
|
|