@defai.digital/ax-cli 3.15.21 → 3.15.24

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.
Files changed (261) hide show
  1. package/README.md +22 -2
  2. package/dist/agent/agent-executor.d.ts +1 -1
  3. package/dist/agent/agent-executor.js +15 -17
  4. package/dist/agent/agent-executor.js.map +1 -1
  5. package/dist/agent/execution/tool-executor.d.ts +6 -0
  6. package/dist/agent/execution/tool-executor.js +16 -1
  7. package/dist/agent/execution/tool-executor.js.map +1 -1
  8. package/dist/agent/llm-agent.js +91 -22
  9. package/dist/agent/llm-agent.js.map +1 -1
  10. package/dist/agent/parallel-tools.d.ts +65 -0
  11. package/dist/agent/parallel-tools.js +146 -0
  12. package/dist/agent/parallel-tools.js.map +1 -0
  13. package/dist/llm/tools.js +1 -1
  14. package/dist/llm/tools.js.map +1 -1
  15. package/dist/ui/components/chat-interface.js +14 -0
  16. package/dist/ui/components/chat-interface.js.map +1 -1
  17. package/dist/ui/hooks/use-input-handler.js +2 -2
  18. package/dist/ui/hooks/use-input-handler.js.map +1 -1
  19. package/dist/ui/utils/image-handler.js +8 -5
  20. package/dist/ui/utils/image-handler.js.map +1 -1
  21. package/package.json +1 -1
  22. package/dist/analyzers/architecture/anti-pattern-detectors/god-object-detector.d.ts +0 -29
  23. package/dist/analyzers/architecture/anti-pattern-detectors/god-object-detector.js +0 -103
  24. package/dist/analyzers/architecture/anti-pattern-detectors/god-object-detector.js.map +0 -1
  25. package/dist/analyzers/architecture/architecture-analyzer.d.ts +0 -58
  26. package/dist/analyzers/architecture/architecture-analyzer.js +0 -276
  27. package/dist/analyzers/architecture/architecture-analyzer.js.map +0 -1
  28. package/dist/analyzers/architecture/index.d.ts +0 -12
  29. package/dist/analyzers/architecture/index.js +0 -14
  30. package/dist/analyzers/architecture/index.js.map +0 -1
  31. package/dist/analyzers/architecture/pattern-detectors/base-detector.d.ts +0 -27
  32. package/dist/analyzers/architecture/pattern-detectors/base-detector.js +0 -31
  33. package/dist/analyzers/architecture/pattern-detectors/base-detector.js.map +0 -1
  34. package/dist/analyzers/architecture/pattern-detectors/clean-architecture-detector.d.ts +0 -11
  35. package/dist/analyzers/architecture/pattern-detectors/clean-architecture-detector.js +0 -57
  36. package/dist/analyzers/architecture/pattern-detectors/clean-architecture-detector.js.map +0 -1
  37. package/dist/analyzers/architecture/pattern-detectors/mvc-detector.d.ts +0 -11
  38. package/dist/analyzers/architecture/pattern-detectors/mvc-detector.js +0 -43
  39. package/dist/analyzers/architecture/pattern-detectors/mvc-detector.js.map +0 -1
  40. package/dist/analyzers/architecture/pattern-detectors/repository-detector.d.ts +0 -11
  41. package/dist/analyzers/architecture/pattern-detectors/repository-detector.js +0 -49
  42. package/dist/analyzers/architecture/pattern-detectors/repository-detector.js.map +0 -1
  43. package/dist/analyzers/architecture/project-structure-scanner.d.ts +0 -54
  44. package/dist/analyzers/architecture/project-structure-scanner.js +0 -204
  45. package/dist/analyzers/architecture/project-structure-scanner.js.map +0 -1
  46. package/dist/analyzers/ast/index.d.ts +0 -13
  47. package/dist/analyzers/ast/index.js +0 -16
  48. package/dist/analyzers/ast/index.js.map +0 -1
  49. package/dist/analyzers/ast/language-parser.d.ts +0 -59
  50. package/dist/analyzers/ast/language-parser.js +0 -107
  51. package/dist/analyzers/ast/language-parser.js.map +0 -1
  52. package/dist/analyzers/ast/multi-language-parser.d.ts +0 -79
  53. package/dist/analyzers/ast/multi-language-parser.js +0 -157
  54. package/dist/analyzers/ast/multi-language-parser.js.map +0 -1
  55. package/dist/analyzers/ast/node-helpers.d.ts +0 -81
  56. package/dist/analyzers/ast/node-helpers.js +0 -128
  57. package/dist/analyzers/ast/node-helpers.js.map +0 -1
  58. package/dist/analyzers/ast/parser.d.ts +0 -60
  59. package/dist/analyzers/ast/parser.js +0 -305
  60. package/dist/analyzers/ast/parser.js.map +0 -1
  61. package/dist/analyzers/ast/traverser.d.ts +0 -67
  62. package/dist/analyzers/ast/traverser.js +0 -156
  63. package/dist/analyzers/ast/traverser.js.map +0 -1
  64. package/dist/analyzers/ast/types.d.ts +0 -107
  65. package/dist/analyzers/ast/types.js +0 -7
  66. package/dist/analyzers/ast/types.js.map +0 -1
  67. package/dist/analyzers/best-practices/base-rule.d.ts +0 -45
  68. package/dist/analyzers/best-practices/base-rule.js +0 -45
  69. package/dist/analyzers/best-practices/base-rule.js.map +0 -1
  70. package/dist/analyzers/best-practices/best-practice-validator.d.ts +0 -35
  71. package/dist/analyzers/best-practices/best-practice-validator.js +0 -181
  72. package/dist/analyzers/best-practices/best-practice-validator.js.map +0 -1
  73. package/dist/analyzers/best-practices/index.d.ts +0 -10
  74. package/dist/analyzers/best-practices/index.js +0 -11
  75. package/dist/analyzers/best-practices/index.js.map +0 -1
  76. package/dist/analyzers/best-practices/rules/index.d.ts +0 -7
  77. package/dist/analyzers/best-practices/rules/index.js +0 -56
  78. package/dist/analyzers/best-practices/rules/index.js.map +0 -1
  79. package/dist/analyzers/best-practices/rules/typescript/consistent-naming.d.ts +0 -17
  80. package/dist/analyzers/best-practices/rules/typescript/consistent-naming.js +0 -41
  81. package/dist/analyzers/best-practices/rules/typescript/consistent-naming.js.map +0 -1
  82. package/dist/analyzers/best-practices/rules/typescript/function-complexity.d.ts +0 -27
  83. package/dist/analyzers/best-practices/rules/typescript/function-complexity.js +0 -76
  84. package/dist/analyzers/best-practices/rules/typescript/function-complexity.js.map +0 -1
  85. package/dist/analyzers/best-practices/rules/typescript/index.d.ts +0 -15
  86. package/dist/analyzers/best-practices/rules/typescript/index.js +0 -16
  87. package/dist/analyzers/best-practices/rules/typescript/index.js.map +0 -1
  88. package/dist/analyzers/best-practices/rules/typescript/max-file-length.d.ts +0 -18
  89. package/dist/analyzers/best-practices/rules/typescript/max-file-length.js +0 -25
  90. package/dist/analyzers/best-practices/rules/typescript/max-file-length.js.map +0 -1
  91. package/dist/analyzers/best-practices/rules/typescript/no-any-type.d.ts +0 -17
  92. package/dist/analyzers/best-practices/rules/typescript/no-any-type.js +0 -27
  93. package/dist/analyzers/best-practices/rules/typescript/no-any-type.js.map +0 -1
  94. package/dist/analyzers/best-practices/rules/typescript/no-implicit-any.d.ts +0 -18
  95. package/dist/analyzers/best-practices/rules/typescript/no-implicit-any.js +0 -39
  96. package/dist/analyzers/best-practices/rules/typescript/no-implicit-any.js.map +0 -1
  97. package/dist/analyzers/best-practices/rules/typescript/no-magic-numbers.d.ts +0 -17
  98. package/dist/analyzers/best-practices/rules/typescript/no-magic-numbers.js +0 -38
  99. package/dist/analyzers/best-practices/rules/typescript/no-magic-numbers.js.map +0 -1
  100. package/dist/analyzers/best-practices/rules/typescript/no-unused-vars.d.ts +0 -17
  101. package/dist/analyzers/best-practices/rules/typescript/no-unused-vars.js +0 -38
  102. package/dist/analyzers/best-practices/rules/typescript/no-unused-vars.js.map +0 -1
  103. package/dist/analyzers/best-practices/rules/typescript/prefer-const.d.ts +0 -17
  104. package/dist/analyzers/best-practices/rules/typescript/prefer-const.js +0 -35
  105. package/dist/analyzers/best-practices/rules/typescript/prefer-const.js.map +0 -1
  106. package/dist/analyzers/best-practices/rules/typescript/prefer-readonly.d.ts +0 -17
  107. package/dist/analyzers/best-practices/rules/typescript/prefer-readonly.js +0 -36
  108. package/dist/analyzers/best-practices/rules/typescript/prefer-readonly.js.map +0 -1
  109. package/dist/analyzers/best-practices/rules/typescript/proper-error-handling.d.ts +0 -17
  110. package/dist/analyzers/best-practices/rules/typescript/proper-error-handling.js +0 -27
  111. package/dist/analyzers/best-practices/rules/typescript/proper-error-handling.js.map +0 -1
  112. package/dist/analyzers/best-practices/types.d.ts +0 -86
  113. package/dist/analyzers/best-practices/types.js +0 -7
  114. package/dist/analyzers/best-practices/types.js.map +0 -1
  115. package/dist/analyzers/cache/analysis-cache.d.ts +0 -41
  116. package/dist/analyzers/cache/analysis-cache.js +0 -84
  117. package/dist/analyzers/cache/analysis-cache.js.map +0 -1
  118. package/dist/analyzers/code-smells/base-smell-detector.d.ts +0 -30
  119. package/dist/analyzers/code-smells/base-smell-detector.js +0 -44
  120. package/dist/analyzers/code-smells/base-smell-detector.js.map +0 -1
  121. package/dist/analyzers/code-smells/code-smell-analyzer.d.ts +0 -30
  122. package/dist/analyzers/code-smells/code-smell-analyzer.js +0 -167
  123. package/dist/analyzers/code-smells/code-smell-analyzer.js.map +0 -1
  124. package/dist/analyzers/code-smells/detectors/data-clumps-detector.d.ts +0 -11
  125. package/dist/analyzers/code-smells/detectors/data-clumps-detector.js +0 -64
  126. package/dist/analyzers/code-smells/detectors/data-clumps-detector.js.map +0 -1
  127. package/dist/analyzers/code-smells/detectors/dead-code-detector.d.ts +0 -11
  128. package/dist/analyzers/code-smells/detectors/dead-code-detector.js +0 -58
  129. package/dist/analyzers/code-smells/detectors/dead-code-detector.js.map +0 -1
  130. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.d.ts +0 -11
  131. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js +0 -69
  132. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js.map +0 -1
  133. package/dist/analyzers/code-smells/detectors/feature-envy-detector.d.ts +0 -11
  134. package/dist/analyzers/code-smells/detectors/feature-envy-detector.js +0 -70
  135. package/dist/analyzers/code-smells/detectors/feature-envy-detector.js.map +0 -1
  136. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.d.ts +0 -11
  137. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js +0 -59
  138. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js.map +0 -1
  139. package/dist/analyzers/code-smells/detectors/large-class-detector.d.ts +0 -13
  140. package/dist/analyzers/code-smells/detectors/large-class-detector.js +0 -61
  141. package/dist/analyzers/code-smells/detectors/large-class-detector.js.map +0 -1
  142. package/dist/analyzers/code-smells/detectors/long-method-detector.d.ts +0 -12
  143. package/dist/analyzers/code-smells/detectors/long-method-detector.js +0 -55
  144. package/dist/analyzers/code-smells/detectors/long-method-detector.js.map +0 -1
  145. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.d.ts +0 -12
  146. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js +0 -53
  147. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js.map +0 -1
  148. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.d.ts +0 -12
  149. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js +0 -56
  150. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js.map +0 -1
  151. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.d.ts +0 -13
  152. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js +0 -77
  153. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js.map +0 -1
  154. package/dist/analyzers/code-smells/index.d.ts +0 -16
  155. package/dist/analyzers/code-smells/index.js +0 -19
  156. package/dist/analyzers/code-smells/index.js.map +0 -1
  157. package/dist/analyzers/code-smells/types.d.ts +0 -82
  158. package/dist/analyzers/code-smells/types.js +0 -30
  159. package/dist/analyzers/code-smells/types.js.map +0 -1
  160. package/dist/analyzers/dependency/circular-detector.d.ts +0 -17
  161. package/dist/analyzers/dependency/circular-detector.js +0 -73
  162. package/dist/analyzers/dependency/circular-detector.js.map +0 -1
  163. package/dist/analyzers/dependency/coupling-calculator.d.ts +0 -24
  164. package/dist/analyzers/dependency/coupling-calculator.js +0 -86
  165. package/dist/analyzers/dependency/coupling-calculator.js.map +0 -1
  166. package/dist/analyzers/dependency/dependency-analyzer.d.ts +0 -44
  167. package/dist/analyzers/dependency/dependency-analyzer.js +0 -218
  168. package/dist/analyzers/dependency/dependency-analyzer.js.map +0 -1
  169. package/dist/analyzers/dependency/dependency-graph.d.ts +0 -57
  170. package/dist/analyzers/dependency/dependency-graph.js +0 -198
  171. package/dist/analyzers/dependency/dependency-graph.js.map +0 -1
  172. package/dist/analyzers/dependency/index.d.ts +0 -8
  173. package/dist/analyzers/dependency/index.js +0 -8
  174. package/dist/analyzers/dependency/index.js.map +0 -1
  175. package/dist/analyzers/dependency/types.d.ts +0 -105
  176. package/dist/analyzers/dependency/types.js +0 -5
  177. package/dist/analyzers/dependency/types.js.map +0 -1
  178. package/dist/analyzers/errors.d.ts +0 -51
  179. package/dist/analyzers/errors.js +0 -79
  180. package/dist/analyzers/errors.js.map +0 -1
  181. package/dist/analyzers/git/churn-calculator.d.ts +0 -36
  182. package/dist/analyzers/git/churn-calculator.js +0 -257
  183. package/dist/analyzers/git/churn-calculator.js.map +0 -1
  184. package/dist/analyzers/git/git-analyzer.d.ts +0 -19
  185. package/dist/analyzers/git/git-analyzer.js +0 -79
  186. package/dist/analyzers/git/git-analyzer.js.map +0 -1
  187. package/dist/analyzers/git/hotspot-detector.d.ts +0 -34
  188. package/dist/analyzers/git/hotspot-detector.js +0 -173
  189. package/dist/analyzers/git/hotspot-detector.js.map +0 -1
  190. package/dist/analyzers/git/index.d.ts +0 -7
  191. package/dist/analyzers/git/index.js +0 -7
  192. package/dist/analyzers/git/index.js.map +0 -1
  193. package/dist/analyzers/git/types.d.ts +0 -88
  194. package/dist/analyzers/git/types.js +0 -5
  195. package/dist/analyzers/git/types.js.map +0 -1
  196. package/dist/analyzers/metrics/halstead-calculator.d.ts +0 -30
  197. package/dist/analyzers/metrics/halstead-calculator.js +0 -150
  198. package/dist/analyzers/metrics/halstead-calculator.js.map +0 -1
  199. package/dist/analyzers/metrics/index.d.ts +0 -9
  200. package/dist/analyzers/metrics/index.js +0 -9
  201. package/dist/analyzers/metrics/index.js.map +0 -1
  202. package/dist/analyzers/metrics/maintainability-calculator.d.ts +0 -17
  203. package/dist/analyzers/metrics/maintainability-calculator.js +0 -46
  204. package/dist/analyzers/metrics/maintainability-calculator.js.map +0 -1
  205. package/dist/analyzers/metrics/metrics-analyzer.d.ts +0 -32
  206. package/dist/analyzers/metrics/metrics-analyzer.js +0 -144
  207. package/dist/analyzers/metrics/metrics-analyzer.js.map +0 -1
  208. package/dist/analyzers/metrics/types.d.ts +0 -67
  209. package/dist/analyzers/metrics/types.js +0 -5
  210. package/dist/analyzers/metrics/types.js.map +0 -1
  211. package/dist/analyzers/security/base-detector.d.ts +0 -58
  212. package/dist/analyzers/security/base-detector.js +0 -104
  213. package/dist/analyzers/security/base-detector.js.map +0 -1
  214. package/dist/analyzers/security/detectors/command-injection-detector.d.ts +0 -12
  215. package/dist/analyzers/security/detectors/command-injection-detector.js +0 -84
  216. package/dist/analyzers/security/detectors/command-injection-detector.js.map +0 -1
  217. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.d.ts +0 -16
  218. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js +0 -140
  219. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js.map +0 -1
  220. package/dist/analyzers/security/detectors/insecure-deserialization-detector.d.ts +0 -12
  221. package/dist/analyzers/security/detectors/insecure-deserialization-detector.js +0 -109
  222. package/dist/analyzers/security/detectors/insecure-deserialization-detector.js.map +0 -1
  223. package/dist/analyzers/security/detectors/insecure-random-detector.d.ts +0 -12
  224. package/dist/analyzers/security/detectors/insecure-random-detector.js +0 -61
  225. package/dist/analyzers/security/detectors/insecure-random-detector.js.map +0 -1
  226. package/dist/analyzers/security/detectors/path-traversal-detector.d.ts +0 -12
  227. package/dist/analyzers/security/detectors/path-traversal-detector.js +0 -82
  228. package/dist/analyzers/security/detectors/path-traversal-detector.js.map +0 -1
  229. package/dist/analyzers/security/detectors/sql-injection-detector.d.ts +0 -12
  230. package/dist/analyzers/security/detectors/sql-injection-detector.js +0 -88
  231. package/dist/analyzers/security/detectors/sql-injection-detector.js.map +0 -1
  232. package/dist/analyzers/security/detectors/weak-crypto-detector.d.ts +0 -12
  233. package/dist/analyzers/security/detectors/weak-crypto-detector.js +0 -104
  234. package/dist/analyzers/security/detectors/weak-crypto-detector.js.map +0 -1
  235. package/dist/analyzers/security/detectors/xss-detector.d.ts +0 -12
  236. package/dist/analyzers/security/detectors/xss-detector.js +0 -90
  237. package/dist/analyzers/security/detectors/xss-detector.js.map +0 -1
  238. package/dist/analyzers/security/index.d.ts +0 -16
  239. package/dist/analyzers/security/index.js +0 -18
  240. package/dist/analyzers/security/index.js.map +0 -1
  241. package/dist/analyzers/security/security-analyzer.d.ts +0 -38
  242. package/dist/analyzers/security/security-analyzer.js +0 -215
  243. package/dist/analyzers/security/security-analyzer.js.map +0 -1
  244. package/dist/analyzers/security/types.d.ts +0 -95
  245. package/dist/analyzers/security/types.js +0 -7
  246. package/dist/analyzers/security/types.js.map +0 -1
  247. package/dist/tools/analysis-tools/architecture-tool.d.ts +0 -46
  248. package/dist/tools/analysis-tools/architecture-tool.js +0 -124
  249. package/dist/tools/analysis-tools/architecture-tool.js.map +0 -1
  250. package/dist/tools/analysis-tools/validation-tool.d.ts +0 -51
  251. package/dist/tools/analysis-tools/validation-tool.js +0 -121
  252. package/dist/tools/analysis-tools/validation-tool.js.map +0 -1
  253. package/dist/tools/analysis-tools.d.ts +0 -73
  254. package/dist/tools/analysis-tools.js +0 -422
  255. package/dist/tools/analysis-tools.js.map +0 -1
  256. package/dist/types/analysis.d.ts +0 -177
  257. package/dist/types/analysis.js +0 -8
  258. package/dist/types/analysis.js.map +0 -1
  259. package/dist/utils/analysis-logger.d.ts +0 -50
  260. package/dist/utils/analysis-logger.js +0 -73
  261. package/dist/utils/analysis-logger.js.map +0 -1
@@ -1,18 +0,0 @@
1
- /**
2
- * Max File Length Rule
3
- *
4
- * Files should not exceed 300 lines for better maintainability
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- import type { Violation, Severity } from '../../../../types/analysis.js';
8
- import type { RuleCategory } from '../../types.js';
9
- export declare class MaxFileLengthRule extends BaseValidationRule {
10
- readonly id = "max-file-length";
11
- readonly name = "Max File Length";
12
- readonly description = "Files should not exceed 300 lines for better maintainability";
13
- readonly severity: Severity;
14
- readonly category: RuleCategory;
15
- readonly autoFixable = false;
16
- private readonly MAX_LINES;
17
- check(filePath: string, content: string): Promise<Violation[]>;
18
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * Max File Length Rule
3
- *
4
- * Files should not exceed 300 lines for better maintainability
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- export class MaxFileLengthRule extends BaseValidationRule {
8
- id = 'max-file-length';
9
- name = 'Max File Length';
10
- description = 'Files should not exceed 300 lines for better maintainability';
11
- severity = 'low';
12
- category = 'maintainability';
13
- autoFixable = false;
14
- MAX_LINES = 300;
15
- async check(filePath, content) {
16
- const violations = [];
17
- const lines = content.split('\n');
18
- const lineCount = lines.length;
19
- if (lineCount > this.MAX_LINES) {
20
- violations.push(this.createViolation(filePath, 1, 1, `File has ${lineCount} lines, exceeds maximum of ${this.MAX_LINES}.`, 'Consider splitting this file into smaller, focused modules', { lineCount, limit: this.MAX_LINES }));
21
- }
22
- return violations;
23
- }
24
- }
25
- //# sourceMappingURL=max-file-length.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"max-file-length.js","sourceRoot":"","sources":["../../../../../src/analyzers/best-practices/rules/typescript/max-file-length.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxD,MAAM,OAAO,iBAAkB,SAAQ,kBAAkB;IAC9C,EAAE,GAAG,iBAAiB,CAAC;IACvB,IAAI,GAAG,iBAAiB,CAAC;IACzB,WAAW,GAAG,8DAA8D,CAAC;IAC7E,QAAQ,GAAa,KAAK,CAAC;IAC3B,QAAQ,GAAiB,iBAAiB,CAAC;IAC3C,WAAW,GAAG,KAAK,CAAC;IAEZ,SAAS,GAAG,GAAG,CAAC;IAEjC,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,OAAe;QAC3C,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;QAE/B,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YAC/B,UAAU,CAAC,IAAI,CACb,IAAI,CAAC,eAAe,CAClB,QAAQ,EACR,CAAC,EACD,CAAC,EACD,YAAY,SAAS,8BAA8B,IAAI,CAAC,SAAS,GAAG,EACpE,4DAA4D,EAC5D,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,CACrC,CACF,CAAC;QACJ,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -1,17 +0,0 @@
1
- /**
2
- * No Any Type Rule
3
- *
4
- * Detect usage of the 'any' type which defeats TypeScript's type safety
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- import type { Violation, Severity } from '../../../../types/analysis.js';
8
- import type { RuleCategory } from '../../types.js';
9
- export declare class NoAnyTypeRule extends BaseValidationRule {
10
- readonly id = "no-any-type";
11
- readonly name = "No Any Type";
12
- readonly description = "Avoid using the \"any\" type - use specific types instead";
13
- readonly severity: Severity;
14
- readonly category: RuleCategory;
15
- readonly autoFixable = false;
16
- check(filePath: string, content: string): Promise<Violation[]>;
17
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * No Any Type Rule
3
- *
4
- * Detect usage of the 'any' type which defeats TypeScript's type safety
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- export class NoAnyTypeRule extends BaseValidationRule {
8
- id = 'no-any-type';
9
- name = 'No Any Type';
10
- description = 'Avoid using the "any" type - use specific types instead';
11
- severity = 'high';
12
- category = 'type-safety';
13
- autoFixable = false;
14
- async check(filePath, content) {
15
- const violations = [];
16
- // Pattern to match: any type annotations
17
- // Matches: ': any', '<any>', 'Array<any>', etc.
18
- const anyTypePattern = /:\s*any\b|<any>|Array<any>/g;
19
- let match;
20
- while ((match = anyTypePattern.exec(content)) !== null) {
21
- const pos = this.getPosition(content, match.index);
22
- violations.push(this.createViolation(filePath, pos.line, pos.column, 'Avoid using "any" type. Use specific types for better type safety.', 'Replace "any" with a specific type (e.g., string, number, SomeInterface)'));
23
- }
24
- return violations;
25
- }
26
- }
27
- //# sourceMappingURL=no-any-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-any-type.js","sourceRoot":"","sources":["../../../../../src/analyzers/best-practices/rules/typescript/no-any-type.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxD,MAAM,OAAO,aAAc,SAAQ,kBAAkB;IAC1C,EAAE,GAAG,aAAa,CAAC;IACnB,IAAI,GAAG,aAAa,CAAC;IACrB,WAAW,GAAG,yDAAyD,CAAC;IACxE,QAAQ,GAAa,MAAM,CAAC;IAC5B,QAAQ,GAAiB,aAAa,CAAC;IACvC,WAAW,GAAG,KAAK,CAAC;IAE7B,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,OAAe;QAC3C,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,yCAAyC;QACzC,gDAAgD;QAChD,MAAM,cAAc,GAAG,6BAA6B,CAAC;QAErD,IAAI,KAA6B,CAAC;QAClC,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACvD,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAEnD,UAAU,CAAC,IAAI,CACb,IAAI,CAAC,eAAe,CAClB,QAAQ,EACR,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,MAAM,EACV,oEAAoE,EACpE,0EAA0E,CAC3E,CACF,CAAC;QACJ,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -1,18 +0,0 @@
1
- /**
2
- * No Implicit Any Rule
3
- *
4
- * Function parameters and variables should have explicit types
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- import type { Violation, Severity } from '../../../../types/analysis.js';
8
- import type { RuleCategory } from '../../types.js';
9
- export declare class NoImplicitAnyRule extends BaseValidationRule {
10
- readonly id = "no-implicit-any";
11
- readonly name = "No Implicit Any";
12
- readonly description = "Function parameters and variables should have explicit types";
13
- readonly severity: Severity;
14
- readonly category: RuleCategory;
15
- readonly autoFixable = false;
16
- check(filePath: string, content: string): Promise<Violation[]>;
17
- private checkPattern;
18
- }
@@ -1,39 +0,0 @@
1
- /**
2
- * No Implicit Any Rule
3
- *
4
- * Function parameters and variables should have explicit types
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- export class NoImplicitAnyRule extends BaseValidationRule {
8
- id = 'no-implicit-any';
9
- name = 'No Implicit Any';
10
- description = 'Function parameters and variables should have explicit types';
11
- severity = 'medium';
12
- category = 'type-safety';
13
- autoFixable = false;
14
- async check(filePath, content) {
15
- const violations = [];
16
- // Pattern: function parameters without type annotations
17
- const functionPattern = /function\s+\w+\s*\(([^)]+)\)/g;
18
- const arrowFunctionPattern = /\(([^)]+)\)\s*=>/g;
19
- this.checkPattern(content, filePath, functionPattern, violations);
20
- this.checkPattern(content, filePath, arrowFunctionPattern, violations);
21
- return violations;
22
- }
23
- checkPattern(content, filePath, pattern, violations) {
24
- let match;
25
- while ((match = pattern.exec(content)) !== null) {
26
- const params = match[1];
27
- // Check each parameter
28
- const paramList = params.split(',').map(p => p.trim());
29
- for (const param of paramList) {
30
- // If parameter doesn't have a type annotation (no ':')
31
- if (param && !param.includes(':') && param !== '...args') {
32
- const pos = this.getPosition(content, match.index);
33
- violations.push(this.createViolation(filePath, pos.line, pos.column, `Parameter "${param}" has implicit "any" type. Add explicit type annotation.`, `Add type annotation: "${param}: SomeType"`));
34
- }
35
- }
36
- }
37
- }
38
- }
39
- //# sourceMappingURL=no-implicit-any.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-implicit-any.js","sourceRoot":"","sources":["../../../../../src/analyzers/best-practices/rules/typescript/no-implicit-any.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxD,MAAM,OAAO,iBAAkB,S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,CAAC,KAAK,CAAC,CAAC;oBAEnD,UAAU,CAAC,IAAI,CACb,IAAI,CAAC,eAAe,CAClB,QAAQ,EACR,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,MAAM,EACV,cAAc,KAAK,0DAA0D,EAC7E,yBAAyB,KAAK,aAAa,CAC5C,CACF,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -1,17 +0,0 @@
1
- /**
2
- * No Magic Numbers Rule
3
- *
4
- * Use named constants instead of magic numbers
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- import type { Violation, Severity } from '../../../../types/analysis.js';
8
- import type { RuleCategory } from '../../types.js';
9
- export declare class NoMagicNumbersRule extends BaseValidationRule {
10
- readonly id = "no-magic-numbers";
11
- readonly name = "No Magic Numbers";
12
- readonly description = "Use named constants instead of magic numbers";
13
- readonly severity: Severity;
14
- readonly category: RuleCategory;
15
- readonly autoFixable = false;
16
- check(filePath: string, content: string): Promise<Violation[]>;
17
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * No Magic Numbers Rule
3
- *
4
- * Use named constants instead of magic numbers
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- export class NoMagicNumbersRule extends BaseValidationRule {
8
- id = 'no-magic-numbers';
9
- name = 'No Magic Numbers';
10
- description = 'Use named constants instead of magic numbers';
11
- severity = 'low';
12
- category = 'best-practices';
13
- autoFixable = false;
14
- async check(filePath, content) {
15
- const violations = [];
16
- // REDOS FIX: Use simpler pattern without complex lookahead/lookbehind to prevent catastrophic backtracking
17
- // Pattern: word boundary + numeric literals (excluding 0, 1, -1 which are common)
18
- const magicNumberPattern = /\b(?:[2-9]|[1-9]\d+)\b/g;
19
- let match;
20
- while ((match = magicNumberPattern.exec(content)) !== null) {
21
- const number = match[0];
22
- // REDOS FIX: Check context in code instead of using complex lookahead
23
- const afterMatch = content.substring(match.index + number.length, match.index + number.length + 1);
24
- if (afterMatch === ':') {
25
- continue; // Skip numbers followed by colon (e.g., object literals, switch cases)
26
- }
27
- // Skip if it's part of a const declaration
28
- const beforeMatch = content.substring(Math.max(0, match.index - 50), match.index);
29
- if (/const\s+\w+\s*=\s*$/.test(beforeMatch)) {
30
- continue; // This IS a constant declaration
31
- }
32
- const pos = this.getPosition(content, match.index);
33
- violations.push(this.createViolation(filePath, pos.line, pos.column, `Magic number "${number}" found. Use a named constant instead.`, `const MEANINGFUL_NAME = ${number};`));
34
- }
35
- return violations;
36
- }
37
- }
38
- //# sourceMappingURL=no-magic-numbers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-magic-numbers.js","sourceRoot":"","sources":["../../../../../src/analyzers/best-practices/rules/typescript/no-magic-numbers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxD,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;IAC/C,EAAE,GAAG,kBAAkB,CAAC;IACxB,IAAI,GAAG,kBAAkB,CAAC;IAC1B,WAAW,GAAG,8CAA8C,CAAC;IAC7D,QAAQ,GAAa,KAAK,CAAC;IAC3B,QAAQ,GAAiB,gBAAgB,CAAC;IAC1C,WAAW,GAAG,KAAK,CAAC;IAE7B,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,OAAe;QAC3C,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,2GAA2G;QAC3G,kFAAkF;QAClF,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;QAErD,IAAI,KAA6B,CAAC;QAClC,OAAO,CAAC,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAExB,sEAAsE;YACtE,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnG,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;gBACvB,SAAS,CAAC,uEAAuE;YACnF,CAAC;YAED,2CAA2C;YAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAClF,IAAI,qBAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC5C,SAAS,CAAC,iCAAiC;YAC7C,CAAC;YAED,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAEnD,UAAU,CAAC,IAAI,CACb,IAAI,CAAC,eAAe,CAClB,QAAQ,EACR,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,MAAM,EACV,iBAAiB,MAAM,wCAAwC,EAC/D,2BAA2B,MAAM,GAAG,CACrC,CACF,CAAC;QACJ,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -1,17 +0,0 @@
1
- /**
2
- * No Unused Variables Rule
3
- *
4
- * Remove unused variables to keep code clean
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- import type { Violation, Severity } from '../../../../types/analysis.js';
8
- import type { RuleCategory } from '../../types.js';
9
- export declare class NoUnusedVarsRule extends BaseValidationRule {
10
- readonly id = "no-unused-vars";
11
- readonly name = "No Unused Variables";
12
- readonly description = "Remove unused variables to keep code clean";
13
- readonly severity: Severity;
14
- readonly category: RuleCategory;
15
- readonly autoFixable = true;
16
- check(filePath: string, content: string): Promise<Violation[]>;
17
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * No Unused Variables Rule
3
- *
4
- * Remove unused variables to keep code clean
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- export class NoUnusedVarsRule extends BaseValidationRule {
8
- id = 'no-unused-vars';
9
- name = 'No Unused Variables';
10
- description = 'Remove unused variables to keep code clean';
11
- severity = 'medium';
12
- category = 'code-quality';
13
- autoFixable = true;
14
- async check(filePath, content) {
15
- const violations = [];
16
- // Simple heuristic: Look for variable declarations and check if they're used
17
- const varPattern = /(?:const|let|var)\s+(\w+)\s*=/g;
18
- let match;
19
- while ((match = varPattern.exec(content)) !== null) {
20
- const varName = match[1];
21
- // Don't check common patterns
22
- if (varName.startsWith('_'))
23
- continue; // Intentionally unused
24
- // Count occurrences of the variable name
25
- // Escape special regex characters in variable name
26
- const escapedVarName = varName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
27
- const usagePattern = new RegExp(`\\b${escapedVarName}\\b`, 'g');
28
- const usages = content.match(usagePattern);
29
- // If only appears once (the declaration), it's unused
30
- if (usages && usages.length === 1) {
31
- const pos = this.getPosition(content, match.index);
32
- violations.push(this.createViolation(filePath, pos.line, pos.column, `Variable "${varName}" is declared but never used.`, `Remove the unused variable or prefix with "_" if intentionally unused`));
33
- }
34
- }
35
- return violations;
36
- }
37
- }
38
- //# sourceMappingURL=no-unused-vars.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-unused-vars.js","sourceRoot":"","sources":["../../../../../src/analyzers/best-practices/rules/typescript/no-unused-vars.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxD,MAAM,OAAO,gBAAiB,SAAQ,kBAAkB;IAC7C,EAAE,GAAG,gBAAgB,CAAC;IACtB,IAAI,GAAG,qBAAqB,CAAC;IAC7B,WAAW,GAAG,4CAA4C,CAAC;IAC3D,QAAQ,GAAa,QAAQ,CAAC;IAC9B,QAAQ,GAAiB,cAAc,CAAC;IACxC,WAAW,GAAG,IAAI,CAAC;IAE5B,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,OAAe;QAC3C,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,6EAA6E;QAC7E,MAAM,UAAU,GAAG,gCAAgC,CAAC;QAEpD,IAAI,KAA6B,CAAC;QAClC,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACnD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAEzB,8BAA8B;YAC9B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,SAAS,CAAC,uBAAuB;YAE9D,yCAAyC;YACzC,mDAAmD;YACnD,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;YACtE,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,MAAM,cAAc,KAAK,EAAE,GAAG,CAAC,CAAC;YAChE,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAE3C,sDAAsD;YACtD,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;gBAEnD,UAAU,CAAC,IAAI,CACb,IAAI,CAAC,eAAe,CAClB,QAAQ,EACR,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,MAAM,EACV,aAAa,OAAO,+BAA+B,EACnD,uEAAuE,CACxE,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Prefer Const Rule
3
- *
4
- * Prefer const over let when variables are not reassigned
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- import type { Violation, Severity } from '../../../../types/analysis.js';
8
- import type { RuleCategory } from '../../types.js';
9
- export declare class PreferConstRule extends BaseValidationRule {
10
- readonly id = "prefer-const";
11
- readonly name = "Prefer Const";
12
- readonly description = "Use \"const\" instead of \"let\" when variables are not reassigned";
13
- readonly severity: Severity;
14
- readonly category: RuleCategory;
15
- readonly autoFixable = true;
16
- check(filePath: string, content: string): Promise<Violation[]>;
17
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * Prefer Const Rule
3
- *
4
- * Prefer const over let when variables are not reassigned
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- export class PreferConstRule extends BaseValidationRule {
8
- id = 'prefer-const';
9
- name = 'Prefer Const';
10
- description = 'Use "const" instead of "let" when variables are not reassigned';
11
- severity = 'low';
12
- category = 'best-practices';
13
- autoFixable = true;
14
- async check(filePath, content) {
15
- const violations = [];
16
- // Simple heuristic: Look for 'let' declarations
17
- const letPattern = /\blet\s+(\w+)\s*=/g;
18
- let match;
19
- while ((match = letPattern.exec(content)) !== null) {
20
- const variableName = match[1];
21
- const pos = this.getPosition(content, match.index);
22
- // Check if variable is reassigned later (simple check)
23
- // Escape special regex characters in variable name
24
- const escapedVarName = variableName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
25
- const reassignmentPattern = new RegExp(`\\b${escapedVarName}\\s*=`, 'g');
26
- const reassignments = content.match(reassignmentPattern);
27
- // If only one assignment (the declaration), suggest const
28
- if (reassignments && reassignments.length === 1) {
29
- violations.push(this.createViolation(filePath, pos.line, pos.column, `Variable "${variableName}" is never reassigned. Use "const" instead of "let".`, `Change "let ${variableName}" to "const ${variableName}"`));
30
- }
31
- }
32
- return violations;
33
- }
34
- }
35
- //# sourceMappingURL=prefer-const.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prefer-const.js","sourceRoot":"","sources":["../../../../../src/analyzers/best-practices/rules/typescript/prefer-const.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxD,MAAM,OAAO,eAAgB,SAAQ,kBAAkB;IAC5C,EAAE,GAAG,cAAc,CAAC;IACpB,IAAI,GAA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after initialization
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- import type { Violation, Severity } from '../../../../types/analysis.js';
8
- import type { RuleCategory } from '../../types.js';
9
- export declare class PreferReadonlyRule extends BaseValidationRule {
10
- readonly id = "prefer-readonly";
11
- readonly name = "Prefer Readonly";
12
- readonly description = "Use readonly for properties that are not modified after initialization";
13
- readonly severity: Severity;
14
- readonly category: RuleCategory;
15
- readonly autoFixable = true;
16
- check(filePath: string, content: string): Promise<Violation[]>;
17
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * Prefer Readonly Rule
3
- *
4
- * Use readonly for properties that are not modified after initialization
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- export class PreferReadonlyRule extends BaseValidationRule {
8
- id = 'prefer-readonly';
9
- name = 'Prefer Readonly';
10
- description = 'Use readonly for properties that are not modified after initialization';
11
- severity = 'low';
12
- category = 'type-safety';
13
- autoFixable = true;
14
- async check(filePath, content) {
15
- const violations = [];
16
- // Pattern: class properties without readonly
17
- const propertyPattern = /^\s*(private|public|protected)\s+(?!readonly)(\w+):/gm;
18
- let match;
19
- while ((match = propertyPattern.exec(content)) !== null) {
20
- const visibility = match[1];
21
- const propertyName = match[2];
22
- // Check if property is assigned after constructor (simple heuristic)
23
- // Escape special regex characters in property name
24
- const escapedPropName = propertyName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
25
- const assignmentPattern = new RegExp(`this\\.${escapedPropName}\\s*=`, 'g');
26
- const assignments = content.match(assignmentPattern);
27
- // If only assigned once (likely in constructor), suggest readonly
28
- if (assignments && assignments.length === 1) {
29
- const pos = this.getPosition(content, match.index);
30
- violations.push(this.createViolation(filePath, pos.line, pos.column, `Property "${propertyName}" is never modified. Consider making it readonly.`, `${visibility} readonly ${propertyName}:`));
31
- }
32
- }
33
- return violations;
34
- }
35
- }
36
- //# sourceMappingURL=prefer-readonly.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prefer-readonly.js","sourceRoot":"","sources":["../../../../../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AQ,EACR,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,MAAM,EACV,aAAa,YAAY,mDAAmD,EAC5E,GAAG,UAAU,aAAa,YAAY,GAAG,CAC1C,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Proper Error Handling Rule
3
- *
4
- * Catch blocks should not be empty and should handle errors properly
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- import type { Violation, Severity } from '../../../../types/analysis.js';
8
- import type { RuleCategory } from '../../types.js';
9
- export declare class ProperErrorHandlingRule extends BaseValidationRule {
10
- readonly id = "proper-error-handling";
11
- readonly name = "Proper Error Handling";
12
- readonly description = "Catch blocks should not be empty and should handle errors properly";
13
- readonly severity: Severity;
14
- readonly category: RuleCategory;
15
- readonly autoFixable = false;
16
- check(filePath: string, content: string): Promise<Violation[]>;
17
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * Proper Error Handling Rule
3
- *
4
- * Catch blocks should not be empty and should handle errors properly
5
- */
6
- import { BaseValidationRule } from '../../base-rule.js';
7
- export class ProperErrorHandlingRule extends BaseValidationRule {
8
- id = 'proper-error-handling';
9
- name = 'Proper Error Handling';
10
- description = 'Catch blocks should not be empty and should handle errors properly';
11
- severity = 'high';
12
- category = 'code-quality';
13
- autoFixable = false;
14
- async check(filePath, content) {
15
- const violations = [];
16
- // Pattern: catch blocks with empty or minimal handling
17
- const emptyCatchPattern = /catch\s*\([^)]*\)\s*\{\s*\}/g;
18
- let match;
19
- // Check for completely empty catch blocks
20
- while ((match = emptyCatchPattern.exec(content)) !== null) {
21
- const pos = this.getPosition(content, match.index);
22
- violations.push(this.createViolation(filePath, pos.line, pos.column, 'Empty catch block. Handle or log the error properly.', 'Add error logging: console.error(error) or rethrow the error'));
23
- }
24
- return violations;
25
- }
26
- }
27
- //# sourceMappingURL=proper-error-handling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proper-error-handling.js","sourceRoot":"","sources":["../../../../../src/analyzers/best-practices/rules/typescript/proper-error-handling.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxD,MAAM,OAAO,uBAAwB,SAAQ,kBAAkB;IACpD,EAAE,GAAG,uBAAuB,CAAC;IAC7B,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GAAG,oEAAoE,CAAC;IACnF,QAAQ,GAAa,MAAM,CAAC;IAC5B,QAAQ,GAAiB,cAAc,CAAC;IACxC,WAAW,GAAG,KAAK,CAAC;IAE7B,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,OAAe;QAC3C,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,uDAAuD;QACvD,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;QAEzD,IAAI,KAA6B,CAAC;QAElC,0CAA0C;QAC1C,OAAO,CAAC,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAEnD,UAAU,CAAC,IAAI,CACb,IAAI,CAAC,eAAe,CAClB,QAAQ,EACR,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,MAAM,EACV,sDAAsD,EACtD,8DAA8D,CAC/D,CACF,CAAC;QACJ,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -1,86 +0,0 @@
1
- /**
2
- * Best Practice Validator Types
3
- *
4
- * Type definitions for validation rules and results
5
- */
6
- import type { Violation, ValidationResult, BatchValidationResult } from '../../types/analysis.js';
7
- import type { Severity } from '../../types/analysis.js';
8
- /**
9
- * Rule category classification
10
- */
11
- export type RuleCategory = 'type-safety' | 'code-quality' | 'maintainability' | 'performance' | 'security' | 'best-practices';
12
- /**
13
- * Validation rule interface
14
- * All rules must implement this interface
15
- */
16
- export interface ValidationRule {
17
- readonly id: string;
18
- readonly name: string;
19
- readonly description: string;
20
- readonly severity: Severity;
21
- readonly category: RuleCategory;
22
- readonly autoFixable: boolean;
23
- /**
24
- * Check a file for violations of this rule
25
- */
26
- check(filePath: string, content: string): Promise<Violation[]>;
27
- /**
28
- * Generate automated fix for a violation (if autoFixable)
29
- */
30
- fix?(violation: Violation, content: string): Promise<ViolationFix | null>;
31
- }
32
- /**
33
- * Automated fix for a violation
34
- */
35
- export interface ViolationFix {
36
- readonly description: string;
37
- readonly edits: ReadonlyArray<TextEdit>;
38
- }
39
- /**
40
- * Text edit for automated fixes
41
- */
42
- export interface TextEdit {
43
- readonly range: TextRange;
44
- readonly newText: string;
45
- }
46
- /**
47
- * Text range
48
- */
49
- export interface TextRange {
50
- readonly start: Position;
51
- readonly end: Position;
52
- }
53
- /**
54
- * Position in text
55
- */
56
- export interface Position {
57
- readonly line: number;
58
- readonly column: number;
59
- }
60
- /**
61
- * Rule configuration
62
- */
63
- export interface RuleConfig {
64
- readonly enabled: boolean;
65
- readonly severity?: Severity;
66
- readonly options?: Readonly<Record<string, unknown>>;
67
- }
68
- /**
69
- * Validation options
70
- */
71
- export interface ValidationOptions {
72
- readonly rules?: Readonly<Record<string, RuleConfig>>;
73
- readonly language?: 'typescript' | 'javascript';
74
- readonly fix?: boolean;
75
- }
76
- /**
77
- * Rule registry interface
78
- * Manages all available rules
79
- */
80
- export interface RuleRegistry {
81
- register(rule: ValidationRule): void;
82
- get(id: string): ValidationRule | undefined;
83
- getAll(): readonly ValidationRule[];
84
- getByCategory(category: RuleCategory): readonly ValidationRule[];
85
- }
86
- export type { Violation, ValidationResult, BatchValidationResult };
@@ -1,7 +0,0 @@
1
- /**
2
- * Best Practice Validator Types
3
- *
4
- * Type definitions for validation rules and results
5
- */
6
- export {};
7
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/analyzers/best-practices/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1,41 +0,0 @@
1
- /**
2
- * Analysis Cache
3
- *
4
- * LRU cache for analysis results with TTL and content hash validation.
5
- * Prevents re-analyzing unchanged projects.
6
- */
7
- export declare class AnalysisCache<T> {
8
- private cache;
9
- private readonly ttl;
10
- private readonly maxSize;
11
- /**
12
- * Create new analysis cache
13
- * @param ttl Time-to-live in milliseconds (default: 5 minutes)
14
- * @param maxSize Maximum number of entries (default: 100)
15
- */
16
- constructor(ttl?: number, maxSize?: number);
17
- /**
18
- * Get cached value if it exists and is valid
19
- */
20
- get(key: string, hash: string): Promise<T | null>;
21
- /**
22
- * Set cached value
23
- */
24
- set(key: string, value: T, hash: string): void;
25
- /**
26
- * Check if key exists in cache (doesn't validate expiration)
27
- */
28
- has(key: string): boolean;
29
- /**
30
- * Clear entire cache
31
- */
32
- clear(): void;
33
- /**
34
- * Get cache statistics
35
- */
36
- getStats(): {
37
- size: number;
38
- maxSize: number;
39
- ttl: number;
40
- };
41
- }