@vibedrift/cli 0.5.1 → 0.5.2

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/dist/index.js CHANGED
@@ -4318,35 +4318,47 @@ var complexityAnalyzer = {
4318
4318
  const fns = file.tree ? extractFunctions(file.tree.rootNode, file.relativePath, file.language) : extractFunctionsRegex(file.content, file.relativePath);
4319
4319
  allFunctions.push(...fns);
4320
4320
  }
4321
- const highComplexity = allFunctions.filter((f) => f.complexity > 10);
4322
- const veryHighComplexity = allFunctions.filter((f) => f.complexity > 20);
4323
- for (const fn of veryHighComplexity) {
4324
- findings.push({
4325
- analyzerId: "complexity",
4326
- severity: "error",
4327
- confidence: 0.9,
4328
- message: `Function "${fn.name}" has cyclomatic complexity ${fn.complexity} (threshold: 20)`,
4329
- locations: [{
4330
- file: fn.file,
4331
- line: fn.line,
4332
- snippet: `${fn.name}() \u2014 ${fn.lineCount} lines, complexity ${fn.complexity}`
4333
- }],
4334
- tags: ["complexity", "critical"]
4335
- });
4336
- }
4337
- for (const fn of highComplexity.filter((f) => f.complexity <= 20)) {
4338
- findings.push({
4339
- analyzerId: "complexity",
4340
- severity: "warning",
4341
- confidence: 0.85,
4342
- message: `Function "${fn.name}" has cyclomatic complexity ${fn.complexity} (threshold: 10)`,
4343
- locations: [{
4344
- file: fn.file,
4345
- line: fn.line,
4346
- snippet: `${fn.name}() \u2014 ${fn.lineCount} lines, complexity ${fn.complexity}`
4347
- }],
4348
- tags: ["complexity", "high"]
4349
- });
4321
+ for (const fn of allFunctions) {
4322
+ if (fn.complexity > 20) {
4323
+ findings.push({
4324
+ analyzerId: "complexity",
4325
+ severity: "error",
4326
+ confidence: 0.9,
4327
+ message: `Function "${fn.name}" has cyclomatic complexity ${fn.complexity} (threshold: 20)`,
4328
+ locations: [{
4329
+ file: fn.file,
4330
+ line: fn.line,
4331
+ snippet: `${fn.name}() \u2014 ${fn.lineCount} lines, complexity ${fn.complexity}`
4332
+ }],
4333
+ tags: ["complexity", "critical"]
4334
+ });
4335
+ } else if (fn.complexity > 15) {
4336
+ findings.push({
4337
+ analyzerId: "complexity",
4338
+ severity: "warning",
4339
+ confidence: 0.75,
4340
+ message: `Function "${fn.name}" has cyclomatic complexity ${fn.complexity} (threshold: 15)`,
4341
+ locations: [{
4342
+ file: fn.file,
4343
+ line: fn.line,
4344
+ snippet: `${fn.name}() \u2014 ${fn.lineCount} lines, complexity ${fn.complexity}`
4345
+ }],
4346
+ tags: ["complexity", "high"]
4347
+ });
4348
+ } else if (fn.complexity > 10) {
4349
+ findings.push({
4350
+ analyzerId: "complexity",
4351
+ severity: "info",
4352
+ confidence: 0.5,
4353
+ message: `Function "${fn.name}" has cyclomatic complexity ${fn.complexity} (threshold: 10)`,
4354
+ locations: [{
4355
+ file: fn.file,
4356
+ line: fn.line,
4357
+ snippet: `${fn.name}() \u2014 ${fn.lineCount} lines, complexity ${fn.complexity}`
4358
+ }],
4359
+ tags: ["complexity", "moderate"]
4360
+ });
4361
+ }
4350
4362
  }
4351
4363
  if (allFunctions.length > 0) {
4352
4364
  const avgComplexity = allFunctions.reduce((s, f) => s + f.complexity, 0) / allFunctions.length;