tech-debt-score 0.1.4 → 0.1.5

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tech-debt-score",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "main": "dist/cli/index.js",
6
6
  "bin": {
@@ -55,6 +55,12 @@ export class TerminalReporter implements IReporter {
55
55
  console.log(` ${finding.filePath}${finding.location ? `:${finding.location.startLine}` : ''}`);
56
56
  }
57
57
  console.log('\n');
58
+ } else if (report.metadata.filesAnalyzed > 0) {
59
+ console.log('✨ No issues found! Your codebase looks clean.');
60
+ console.log('\n');
61
+ } else {
62
+ console.log('❓ No files were analyzed. Check your configuration or directory.');
63
+ console.log('\n');
58
64
  }
59
65
 
60
66
  console.log('═'.repeat(60));
@@ -34,27 +34,46 @@ export class AnalysisService {
34
34
  config.patterns,
35
35
  config.ignore
36
36
  );
37
- console.log(` Found ${filePaths.length} files`);
37
+
38
+ if (filePaths.length === 0) {
39
+ console.log(' ❌ No files found matching patterns.');
40
+ console.log(` Root: ${config.rootPath}`);
41
+ console.log(` Patterns: ${config.patterns.join(', ')}`);
42
+ console.log(' Check your directory structure and ensure files exist.');
43
+ } else {
44
+ console.log(` Found ${filePaths.length} files`);
45
+ }
38
46
 
39
47
  // 2. Read and parse files
40
48
  console.log('🔍 Parsing files...');
41
49
  const allMetrics: Metric[] = [];
42
50
  const fileContents = new Map<string, string>();
43
51
 
52
+ let supportedFilesCount = 0;
44
53
  for (const filePath of filePaths) {
45
- const fileResult = await this.fileReader.read(filePath);
46
- fileContents.set(filePath, fileResult.content);
47
-
48
- if (this.parser.supports(filePath)) {
49
- const parseResult = await this.parser.parse(filePath, fileResult.content);
50
- if (parseResult.success) {
51
- allMetrics.push(...parseResult.metrics);
52
- } else {
53
- console.warn(` ⚠️ Failed to parse ${filePath}: ${parseResult.error}`);
54
+ try {
55
+ const fileResult = await this.fileReader.read(filePath);
56
+ fileContents.set(filePath, fileResult.content);
57
+
58
+ if (this.parser.supports(filePath)) {
59
+ supportedFilesCount++;
60
+ const parseResult = await this.parser.parse(filePath, fileResult.content);
61
+ if (parseResult.success) {
62
+ allMetrics.push(...parseResult.metrics);
63
+ } else {
64
+ console.warn(` ⚠️ Failed to parse ${filePath}: ${parseResult.error}`);
65
+ }
54
66
  }
67
+ } catch (err) {
68
+ console.warn(` ⚠️ Error reading ${filePath}: ${err instanceof Error ? err.message : String(err)}`);
55
69
  }
56
70
  }
57
- console.log(` Extracted ${allMetrics.length} metrics`);
71
+
72
+ if (filePaths.length > 0 && supportedFilesCount === 0) {
73
+ console.log(' ⚠️ None of the found files are supported by the parser (.ts, .js, etc)');
74
+ }
75
+
76
+ console.log(` Extracted ${allMetrics.length} metrics from ${supportedFilesCount} files`);
58
77
 
59
78
  // 3. Analyze dependencies and duplication
60
79
  console.log('🔗 Analyzing dependencies and duplication...');