x-fidelity 3.22.0 → 3.23.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [3.23.0](https://github.com/zotoio/x-fidelity/compare/v3.22.0...v3.23.0) (2025-04-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add null check for issue level in report generator ([6e2db2a](https://github.com/zotoio/x-fidelity/commit/6e2db2ad234c041b8b8fdfc2902a55ee3bdf1b2a))
7
+
8
+
9
+ ### Features
10
+
11
+ * enhance global issues report with detailed formatting and sections ([42e3033](https://github.com/zotoio/x-fidelity/commit/42e3033b9e8cd86c08ef46c3f2470315a336741d))
12
+
1
13
  # [3.22.0](https://github.com/zotoio/x-fidelity/compare/v3.21.1...v3.22.0) (2025-04-02)
2
14
 
3
15
 
@@ -365,16 +365,79 @@ Several files contain potentially sensitive data patterns that shouldn't be logg
365
365
  }
366
366
  let section = `## Other Global Issues
367
367
 
368
+ The following repository-wide issues were detected:
369
+
368
370
  `;
371
+ // Group issues by level for better organization
372
+ const issuesByLevel = {
373
+ 'FATALITY': [],
374
+ 'ERROR': [],
375
+ 'WARNING': [],
376
+ 'EXEMPT': [],
377
+ 'UNKNOWN': []
378
+ };
369
379
  globalIssues.forEach(issue => {
370
- section += `- **${issue.ruleFailure}** (${issue.level}): ${issue.details && issue.details.message ? issue.details.message : 'No details available'}\n`;
371
- // Add condition details if available
372
- if (issue.details && issue.details.conditionDetails) {
373
- const { fact, operator, params } = issue.details.conditionDetails;
374
- section += ` - Condition: Fact \`${fact}\` with operator \`${operator}\`\n`;
375
- if (params) {
376
- section += ` - Parameters: \`${JSON.stringify(params)}\`\n`;
377
- }
380
+ var _a;
381
+ const level = ((_a = issue.level) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || 'UNKNOWN';
382
+ if (issuesByLevel[level]) {
383
+ issuesByLevel[level].push(issue);
384
+ }
385
+ else {
386
+ issuesByLevel['UNKNOWN'].push(issue);
387
+ }
388
+ });
389
+ // Process issues by severity level (highest first)
390
+ ['FATALITY', 'ERROR', 'WARNING', 'EXEMPT', 'UNKNOWN'].forEach(level => {
391
+ const levelIssues = issuesByLevel[level];
392
+ if (levelIssues.length > 0) {
393
+ section += `### ${level} Level Issues\n\n`;
394
+ levelIssues.forEach(issue => {
395
+ // Extract rule name without the -global suffix for cleaner display
396
+ const ruleName = issue.ruleFailure.replace(/-global$/, '');
397
+ section += `#### ${ruleName}\n\n`;
398
+ section += `**Issue**: ${issue.details && issue.details.message ? issue.details.message : 'No details available'}\n\n`;
399
+ // Add rule description if available
400
+ if (issue.details && issue.details.ruleDescription) {
401
+ section += `**Description**: ${issue.details.ruleDescription}\n\n`;
402
+ }
403
+ // Add recommendations if available
404
+ if (issue.details && issue.details.recommendations) {
405
+ section += `**Recommendations**:\n`;
406
+ if (Array.isArray(issue.details.recommendations)) {
407
+ issue.details.recommendations.forEach((rec) => {
408
+ section += `- ${rec}\n`;
409
+ });
410
+ }
411
+ else {
412
+ section += `- ${issue.details.recommendations}\n`;
413
+ }
414
+ section += `\n`;
415
+ }
416
+ // Add condition details in a more readable format
417
+ if (issue.details && issue.details.conditionDetails) {
418
+ const { fact, operator, value, params } = issue.details.conditionDetails;
419
+ section += `**Rule Condition**: \`${fact}\` ${operator} \`${JSON.stringify(value)}\`\n\n`;
420
+ if (params) {
421
+ section += `**Parameters**: \`${JSON.stringify(params, null, 2)}\`\n\n`;
422
+ }
423
+ }
424
+ // Add all conditions if available
425
+ if (issue.details && issue.details.allConditions && issue.details.allConditions.length > 0) {
426
+ section += `**All Conditions** (${issue.details.conditionType || 'unknown'}):\n\n`;
427
+ issue.details.allConditions.forEach((condition, index) => {
428
+ section += `${index + 1}. \`${condition.fact}\` ${condition.operator} \`${JSON.stringify(condition.value)}\`\n`;
429
+ if (condition.params) {
430
+ section += ` Parameters: \`${JSON.stringify(condition.params, null, 2)}\`\n`;
431
+ }
432
+ });
433
+ section += `\n`;
434
+ }
435
+ // Add any additional details
436
+ if (issue.details && issue.details.details) {
437
+ section += `**Additional Details**:\n\`\`\`\n${JSON.stringify(issue.details.details, null, 2)}\n\`\`\`\n\n`;
438
+ }
439
+ section += `---\n\n`;
440
+ });
378
441
  }
379
442
  });
380
443
  return section;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-fidelity",
3
- "version": "3.22.0",
3
+ "version": "3.23.0",
4
4
  "description": "cli for opinionated framework adherence checks",
5
5
  "main": "dist/index",
6
6
  "types": "dist/index.d.ts",
@@ -435,19 +435,88 @@ Several files contain potentially sensitive data patterns that shouldn't be logg
435
435
 
436
436
  let section = `## Other Global Issues
437
437
 
438
+ The following repository-wide issues were detected:
439
+
438
440
  `;
439
441
 
442
+ // Group issues by level for better organization
443
+ const issuesByLevel: Record<string, typeof globalIssues> = {
444
+ 'FATALITY': [],
445
+ 'ERROR': [],
446
+ 'WARNING': [],
447
+ 'EXEMPT': [],
448
+ 'UNKNOWN': []
449
+ };
450
+
440
451
  globalIssues.forEach(issue => {
441
- section += `- **${issue.ruleFailure}** (${issue.level}): ${issue.details && issue.details.message ? issue.details.message : 'No details available'}\n`;
442
-
443
-
444
- // Add condition details if available
445
- if (issue.details && issue.details.conditionDetails) {
446
- const { fact, operator, params } = issue.details.conditionDetails;
447
- section += ` - Condition: Fact \`${fact}\` with operator \`${operator}\`\n`;
448
- if (params) {
449
- section += ` - Parameters: \`${JSON.stringify(params)}\`\n`;
450
- }
452
+ const level = issue.level?.toUpperCase() || 'UNKNOWN';
453
+ if (issuesByLevel[level]) {
454
+ issuesByLevel[level].push(issue);
455
+ } else {
456
+ issuesByLevel['UNKNOWN'].push(issue);
457
+ }
458
+ });
459
+
460
+ // Process issues by severity level (highest first)
461
+ ['FATALITY', 'ERROR', 'WARNING', 'EXEMPT', 'UNKNOWN'].forEach(level => {
462
+ const levelIssues = issuesByLevel[level];
463
+ if (levelIssues.length > 0) {
464
+ section += `### ${level} Level Issues\n\n`;
465
+
466
+ levelIssues.forEach(issue => {
467
+ // Extract rule name without the -global suffix for cleaner display
468
+ const ruleName = issue.ruleFailure.replace(/-global$/, '');
469
+
470
+ section += `#### ${ruleName}\n\n`;
471
+ section += `**Issue**: ${issue.details && issue.details.message ? issue.details.message : 'No details available'}\n\n`;
472
+
473
+ // Add rule description if available
474
+ if (issue.details && issue.details.ruleDescription) {
475
+ section += `**Description**: ${issue.details.ruleDescription}\n\n`;
476
+ }
477
+
478
+ // Add recommendations if available
479
+ if (issue.details && issue.details.recommendations) {
480
+ section += `**Recommendations**:\n`;
481
+ if (Array.isArray(issue.details.recommendations)) {
482
+ issue.details.recommendations.forEach((rec: string) => {
483
+ section += `- ${rec}\n`;
484
+ });
485
+ } else {
486
+ section += `- ${issue.details.recommendations}\n`;
487
+ }
488
+ section += `\n`;
489
+ }
490
+
491
+ // Add condition details in a more readable format
492
+ if (issue.details && issue.details.conditionDetails) {
493
+ const { fact, operator, value, params } = issue.details.conditionDetails;
494
+ section += `**Rule Condition**: \`${fact}\` ${operator} \`${JSON.stringify(value)}\`\n\n`;
495
+
496
+ if (params) {
497
+ section += `**Parameters**: \`${JSON.stringify(params, null, 2)}\`\n\n`;
498
+ }
499
+ }
500
+
501
+ // Add all conditions if available
502
+ if (issue.details && issue.details.allConditions && issue.details.allConditions.length > 0) {
503
+ section += `**All Conditions** (${issue.details.conditionType || 'unknown'}):\n\n`;
504
+ issue.details.allConditions.forEach((condition: any, index: number) => {
505
+ section += `${index + 1}. \`${condition.fact}\` ${condition.operator} \`${JSON.stringify(condition.value)}\`\n`;
506
+ if (condition.params) {
507
+ section += ` Parameters: \`${JSON.stringify(condition.params, null, 2)}\`\n`;
508
+ }
509
+ });
510
+ section += `\n`;
511
+ }
512
+
513
+ // Add any additional details
514
+ if (issue.details && issue.details.details) {
515
+ section += `**Additional Details**:\n\`\`\`\n${JSON.stringify(issue.details.details, null, 2)}\n\`\`\`\n\n`;
516
+ }
517
+
518
+ section += `---\n\n`;
519
+ });
451
520
  }
452
521
  });
453
522
 
@@ -11,21 +11,21 @@
11
11
  "arch": "x64",
12
12
  "cpus": 4,
13
13
  "totalMemory": 16766767104,
14
- "freeMemory": 13935554560
14
+ "freeMemory": 14074646528
15
15
  },
16
16
  "userInfo": {
17
17
  "username": "runner",
18
18
  "homedir": "/home/runner",
19
19
  "shell": "/bin/bash"
20
20
  },
21
- "startTime": 1743588245905
21
+ "startTime": 1743589480504
22
22
  },
23
23
  "memoryUsage": {
24
- "rss": 620613632,
25
- "heapTotal": 387260416,
26
- "heapUsed": 354535912,
27
- "external": 6561592,
28
- "arrayBuffers": 45016352
24
+ "rss": 617349120,
25
+ "heapTotal": 386461696,
26
+ "heapUsed": 354177312,
27
+ "external": 6561591,
28
+ "arrayBuffers": 45016351
29
29
  },
30
30
  "repoXFIConfig": {
31
31
  "sensitiveFileFalsePositives": [],
@@ -85,9 +85,9 @@
85
85
  ]
86
86
  }
87
87
  ],
88
- "startTime": 1743588245905,
89
- "finishTime": 1743588245979,
90
- "durationSeconds": 0.074,
88
+ "startTime": 1743589480504,
89
+ "finishTime": 1743589480512,
90
+ "durationSeconds": 0.008,
91
91
  "fileCount": 2,
92
92
  "totalIssues": 3,
93
93
  "warningCount": 0,
@@ -106,6 +106,6 @@
106
106
  },
107
107
  "repoPath": "mockRepoPath",
108
108
  "repoUrl": "",
109
- "xfiVersion": "3.21.1"
109
+ "xfiVersion": "3.22.0"
110
110
  }
111
111
  }
@@ -3,13 +3,13 @@ Generated for: on 2025-04-02
3
3
 
4
4
  ## Executive Summary
5
5
 
6
- This report presents the results of an X-Fidelity analysis conducted on the repository ``. The analysis identified **3 total issues**, including:
6
+ This report presents the results of an X-Fidelity analysis conducted on the repository ``. The analysis identified **0 total issues**, including:
7
7
  - 0 warnings
8
- - 3 fatalities
8
+ - 0 fatalities
9
9
  - 0 errors
10
10
  - 0 exempt issues
11
11
 
12
- Out of 2 total files, 1 (50.0%) have no issues. The analysis was conducted using X-Fidelity version 3.21.1 and took approximately 0.07 seconds to complete.
12
+ Out of 2 total files, 2 (100.0%) have no issues. The analysis was conducted using X-Fidelity version 3.22.0 and took approximately 0.01 seconds to complete.
13
13
 
14
14
  ## Repository Overview
15
15
 
@@ -18,8 +18,8 @@ Out of 2 total files, 1 (50.0%) have no issues. The analysis was conducted using
18
18
  ```mermaid
19
19
  pie
20
20
  title File Status
21
- "Files with Issues" : 1
22
- "Successful Files" : 1
21
+ "Files with Issues" : 0
22
+ "Successful Files" : 2
23
23
  ```
24
24
 
25
25
  ### Issue Distribution
@@ -28,7 +28,7 @@ pie
28
28
  pie
29
29
  title Issue Distribution
30
30
  "Warnings" : 0
31
- "Fatalities" : 3
31
+ "Fatalities" : 0
32
32
  "Errors" : 0
33
33
  "Exempt" : 0
34
34
  ```
@@ -43,7 +43,6 @@ gantt
43
43
  dateFormat X
44
44
  axisFormat %s
45
45
  section Rule Failures
46
- undefined :0, 3
47
46
  ```
48
47
 
49
48
 
@@ -57,7 +56,6 @@ gantt
57
56
  dateFormat X
58
57
  axisFormat %s
59
58
  section Files
60
- index.ts :0, 1
61
59
  ```
62
60
 
63
61
 
@@ -85,6 +83,3 @@ pie
85
83
 
86
84
 
87
85
 
88
- ## Other Global Issues
89
-
90
- - **undefined** (fatality): Rule failure detected