@principal-ade/code-quality-panels 0.1.23 → 0.1.25

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.
@@ -356,6 +356,418 @@ var useTheme = () => {
356
356
  }
357
357
  return context;
358
358
  };
359
+ var LENS_REGISTRY = [
360
+ // ============================================================
361
+ // LINTING - Code style and bug detection
362
+ // ============================================================
363
+ // TypeScript/JavaScript linting
364
+ {
365
+ id: "eslint",
366
+ name: "ESLint",
367
+ category: "linting",
368
+ languages: ["typescript", "javascript"],
369
+ outputsFileMetrics: true,
370
+ outputsAggregate: true,
371
+ colorScheme: "issues",
372
+ description: "Pluggable linting utility for JavaScript and TypeScript",
373
+ command: "eslint"
374
+ },
375
+ {
376
+ id: "biome-lint",
377
+ name: "Biome Lint",
378
+ category: "linting",
379
+ languages: ["typescript", "javascript"],
380
+ alternativeTo: ["eslint"],
381
+ outputsFileMetrics: true,
382
+ outputsAggregate: true,
383
+ colorScheme: "issues",
384
+ description: "Fast linter for JavaScript and TypeScript",
385
+ command: "biome lint"
386
+ },
387
+ {
388
+ id: "oxlint",
389
+ name: "OxLint",
390
+ category: "linting",
391
+ languages: ["typescript", "javascript"],
392
+ alternativeTo: ["eslint", "biome-lint"],
393
+ outputsFileMetrics: true,
394
+ outputsAggregate: true,
395
+ colorScheme: "issues",
396
+ description: "Blazing fast JavaScript/TypeScript linter",
397
+ command: "oxlint"
398
+ },
399
+ // Python linting
400
+ {
401
+ id: "ruff",
402
+ name: "Ruff",
403
+ category: "linting",
404
+ languages: ["python"],
405
+ alternativeTo: ["pylint", "flake8"],
406
+ outputsFileMetrics: true,
407
+ outputsAggregate: true,
408
+ colorScheme: "issues",
409
+ description: "Extremely fast Python linter",
410
+ command: "ruff check"
411
+ },
412
+ {
413
+ id: "pylint",
414
+ name: "Pylint",
415
+ category: "linting",
416
+ languages: ["python"],
417
+ outputsFileMetrics: true,
418
+ outputsAggregate: true,
419
+ colorScheme: "issues",
420
+ description: "Python static code analyzer",
421
+ command: "pylint"
422
+ },
423
+ // Go linting
424
+ {
425
+ id: "golangci-lint",
426
+ name: "golangci-lint",
427
+ category: "linting",
428
+ languages: ["go"],
429
+ outputsFileMetrics: true,
430
+ outputsAggregate: true,
431
+ colorScheme: "issues",
432
+ description: "Fast linters runner for Go",
433
+ command: "golangci-lint run"
434
+ },
435
+ // Rust linting
436
+ {
437
+ id: "clippy",
438
+ name: "Clippy",
439
+ category: "linting",
440
+ languages: ["rust"],
441
+ outputsFileMetrics: true,
442
+ outputsAggregate: true,
443
+ colorScheme: "issues",
444
+ description: "Rust linter",
445
+ command: "cargo clippy"
446
+ },
447
+ // ============================================================
448
+ // FORMATTING - Code formatting
449
+ // ============================================================
450
+ // TypeScript/JavaScript formatting
451
+ {
452
+ id: "prettier",
453
+ name: "Prettier",
454
+ category: "formatting",
455
+ languages: ["typescript", "javascript"],
456
+ outputsFileMetrics: true,
457
+ outputsAggregate: true,
458
+ colorScheme: "binary",
459
+ description: "Opinionated code formatter",
460
+ command: "prettier --check"
461
+ },
462
+ {
463
+ id: "biome-format",
464
+ name: "Biome Format",
465
+ category: "formatting",
466
+ languages: ["typescript", "javascript"],
467
+ alternativeTo: ["prettier"],
468
+ outputsFileMetrics: true,
469
+ outputsAggregate: true,
470
+ colorScheme: "binary",
471
+ description: "Fast code formatter for JavaScript and TypeScript",
472
+ command: "biome format"
473
+ },
474
+ // Python formatting
475
+ {
476
+ id: "black",
477
+ name: "Black",
478
+ category: "formatting",
479
+ languages: ["python"],
480
+ outputsFileMetrics: true,
481
+ outputsAggregate: true,
482
+ colorScheme: "binary",
483
+ description: "The uncompromising Python code formatter",
484
+ command: "black --check"
485
+ },
486
+ {
487
+ id: "ruff-format",
488
+ name: "Ruff Format",
489
+ category: "formatting",
490
+ languages: ["python"],
491
+ alternativeTo: ["black"],
492
+ outputsFileMetrics: true,
493
+ outputsAggregate: true,
494
+ colorScheme: "binary",
495
+ description: "Fast Python formatter (Ruff)",
496
+ command: "ruff format --check"
497
+ },
498
+ // Go formatting
499
+ {
500
+ id: "gofmt",
501
+ name: "gofmt",
502
+ category: "formatting",
503
+ languages: ["go"],
504
+ outputsFileMetrics: true,
505
+ outputsAggregate: true,
506
+ colorScheme: "binary",
507
+ description: "Go code formatter",
508
+ command: "gofmt -l"
509
+ },
510
+ // Rust formatting
511
+ {
512
+ id: "rustfmt",
513
+ name: "rustfmt",
514
+ category: "formatting",
515
+ languages: ["rust"],
516
+ outputsFileMetrics: true,
517
+ outputsAggregate: true,
518
+ colorScheme: "binary",
519
+ description: "Rust code formatter",
520
+ command: "cargo fmt --check"
521
+ },
522
+ // ============================================================
523
+ // TYPES - Type checking
524
+ // ============================================================
525
+ // TypeScript
526
+ {
527
+ id: "typescript",
528
+ name: "TypeScript",
529
+ category: "types",
530
+ languages: ["typescript"],
531
+ outputsFileMetrics: true,
532
+ outputsAggregate: true,
533
+ colorScheme: "issues",
534
+ description: "TypeScript type checker",
535
+ command: "tsc --noEmit"
536
+ },
537
+ // Python type checking
538
+ {
539
+ id: "mypy",
540
+ name: "MyPy",
541
+ category: "types",
542
+ languages: ["python"],
543
+ outputsFileMetrics: true,
544
+ outputsAggregate: true,
545
+ colorScheme: "issues",
546
+ description: "Static type checker for Python",
547
+ command: "mypy"
548
+ },
549
+ {
550
+ id: "pyright",
551
+ name: "Pyright",
552
+ category: "types",
553
+ languages: ["python"],
554
+ alternativeTo: ["mypy"],
555
+ outputsFileMetrics: true,
556
+ outputsAggregate: true,
557
+ colorScheme: "issues",
558
+ description: "Static type checker for Python",
559
+ command: "pyright"
560
+ },
561
+ // Go type checking (built into compiler)
562
+ {
563
+ id: "go-vet",
564
+ name: "Go Vet",
565
+ category: "types",
566
+ languages: ["go"],
567
+ outputsFileMetrics: true,
568
+ outputsAggregate: true,
569
+ colorScheme: "issues",
570
+ description: "Go static analyzer",
571
+ command: "go vet"
572
+ },
573
+ // ============================================================
574
+ // TESTS - Test coverage and results
575
+ // ============================================================
576
+ // JavaScript/TypeScript testing
577
+ {
578
+ id: "jest",
579
+ name: "Jest",
580
+ category: "tests",
581
+ languages: ["typescript", "javascript"],
582
+ outputsFileMetrics: true,
583
+ outputsAggregate: true,
584
+ colorScheme: "coverage",
585
+ description: "JavaScript testing framework",
586
+ command: "jest --coverage"
587
+ },
588
+ {
589
+ id: "vitest",
590
+ name: "Vitest",
591
+ category: "tests",
592
+ languages: ["typescript", "javascript"],
593
+ alternativeTo: ["jest"],
594
+ outputsFileMetrics: true,
595
+ outputsAggregate: true,
596
+ colorScheme: "coverage",
597
+ description: "Vite-native testing framework",
598
+ command: "vitest run --coverage"
599
+ },
600
+ {
601
+ id: "bun-test",
602
+ name: "Bun Test",
603
+ category: "tests",
604
+ languages: ["typescript", "javascript"],
605
+ alternativeTo: ["jest", "vitest"],
606
+ outputsFileMetrics: true,
607
+ outputsAggregate: true,
608
+ colorScheme: "coverage",
609
+ description: "Bun native test runner",
610
+ command: "bun test"
611
+ },
612
+ // Python testing
613
+ {
614
+ id: "pytest",
615
+ name: "Pytest",
616
+ category: "tests",
617
+ languages: ["python"],
618
+ outputsFileMetrics: true,
619
+ outputsAggregate: true,
620
+ colorScheme: "coverage",
621
+ description: "Python testing framework",
622
+ command: "pytest --cov"
623
+ },
624
+ // Go testing
625
+ {
626
+ id: "go-test",
627
+ name: "Go Test",
628
+ category: "tests",
629
+ languages: ["go"],
630
+ outputsFileMetrics: true,
631
+ outputsAggregate: true,
632
+ colorScheme: "coverage",
633
+ description: "Go test runner",
634
+ command: "go test -cover"
635
+ },
636
+ // Rust testing
637
+ {
638
+ id: "cargo-test",
639
+ name: "Cargo Test",
640
+ category: "tests",
641
+ languages: ["rust"],
642
+ outputsFileMetrics: true,
643
+ outputsAggregate: true,
644
+ colorScheme: "coverage",
645
+ description: "Rust test runner",
646
+ command: "cargo test"
647
+ },
648
+ // ============================================================
649
+ // DEAD CODE - Unused code detection
650
+ // ============================================================
651
+ // TypeScript/JavaScript
652
+ {
653
+ id: "knip",
654
+ name: "Knip",
655
+ category: "dead-code",
656
+ languages: ["typescript", "javascript"],
657
+ outputsFileMetrics: true,
658
+ outputsAggregate: true,
659
+ colorScheme: "issues",
660
+ description: "Find unused files, dependencies and exports",
661
+ command: "knip"
662
+ },
663
+ // Python
664
+ {
665
+ id: "vulture",
666
+ name: "Vulture",
667
+ category: "dead-code",
668
+ languages: ["python"],
669
+ outputsFileMetrics: true,
670
+ outputsAggregate: true,
671
+ colorScheme: "issues",
672
+ description: "Find dead Python code",
673
+ command: "vulture"
674
+ },
675
+ // ============================================================
676
+ // DOCUMENTATION - Documentation coverage
677
+ // ============================================================
678
+ {
679
+ id: "alexandria",
680
+ name: "Alexandria",
681
+ category: "documentation",
682
+ languages: ["typescript", "javascript"],
683
+ outputsFileMetrics: true,
684
+ outputsAggregate: true,
685
+ colorScheme: "binary",
686
+ description: "Documentation coverage checker",
687
+ command: "alexandria lint"
688
+ },
689
+ {
690
+ id: "typedoc",
691
+ name: "TypeDoc",
692
+ category: "documentation",
693
+ languages: ["typescript"],
694
+ outputsFileMetrics: false,
695
+ outputsAggregate: true,
696
+ colorScheme: "coverage",
697
+ description: "TypeScript documentation generator",
698
+ command: "typedoc"
699
+ },
700
+ // ============================================================
701
+ // SECURITY - Security scanning
702
+ // ============================================================
703
+ {
704
+ id: "npm-audit",
705
+ name: "npm audit",
706
+ category: "security",
707
+ languages: ["typescript", "javascript"],
708
+ outputsFileMetrics: false,
709
+ outputsAggregate: true,
710
+ colorScheme: "issues",
711
+ description: "Check for known vulnerabilities in dependencies",
712
+ command: "npm audit"
713
+ },
714
+ {
715
+ id: "bandit",
716
+ name: "Bandit",
717
+ category: "security",
718
+ languages: ["python"],
719
+ outputsFileMetrics: true,
720
+ outputsAggregate: true,
721
+ colorScheme: "issues",
722
+ description: "Python security linter",
723
+ command: "bandit -r"
724
+ }
725
+ ];
726
+ function getLensById(id) {
727
+ return LENS_REGISTRY.find((lens) => lens.id === id);
728
+ }
729
+ function getLensesByCategory(category) {
730
+ return LENS_REGISTRY.filter((lens) => lens.category === category);
731
+ }
732
+ function getCategoryForLens(lensId) {
733
+ var _a;
734
+ return (_a = getLensById(lensId)) == null ? void 0 : _a.category;
735
+ }
736
+ function getColorModeForCategory(category, lensesRan) {
737
+ const lensesInCategory = getLensesByCategory(category);
738
+ for (const lensId of lensesRan) {
739
+ if (lensesInCategory.some((lens) => lens.id === lensId)) {
740
+ return lensId;
741
+ }
742
+ }
743
+ return null;
744
+ }
745
+ var HEXAGON_METRIC_TO_CATEGORY = {
746
+ linting: "linting",
747
+ formatting: "formatting",
748
+ types: "types",
749
+ tests: "tests",
750
+ deadCode: "dead-code",
751
+ documentation: "documentation"
752
+ };
753
+ function isLensInHexagonMetric(lensId, metric) {
754
+ const lensCategory = getCategoryForLens(lensId);
755
+ if (!lensCategory) return false;
756
+ return HEXAGON_METRIC_TO_CATEGORY[metric] === lensCategory;
757
+ }
758
+ function getColorModeForHexagonMetric(metric, lensesRan) {
759
+ const category = HEXAGON_METRIC_TO_CATEGORY[metric];
760
+ return getColorModeForCategory(category, lensesRan);
761
+ }
762
+ function isHexagonMetricConfigured(metric, lensesRan) {
763
+ if (lensesRan === void 0) {
764
+ return true;
765
+ }
766
+ if (lensesRan.length === 0) {
767
+ return false;
768
+ }
769
+ return lensesRan.some((lensId) => isLensInHexagonMetric(lensId, metric));
770
+ }
359
771
  function r(e) {
360
772
  var t, f, n = "";
361
773
  if ("string" == typeof e || "number" == typeof e) n += e;
@@ -426,42 +838,8 @@ function getValueColor$2(value, key) {
426
838
  if (effectiveValue >= 60) return "#E6A700";
427
839
  return "#C62828";
428
840
  }
429
- const LENS_TO_METRIC_MAP = {
430
- // Linting tools
431
- eslint: "linting",
432
- biome: "linting",
433
- "biome-lint": "linting",
434
- oxlint: "linting",
435
- // Type checking tools
436
- typescript: "types",
437
- flow: "types",
438
- // Testing tools
439
- test: "tests",
440
- jest: "tests",
441
- vitest: "tests",
442
- "bun-test": "tests",
443
- mocha: "tests",
444
- playwright: "tests",
445
- cypress: "tests",
446
- // Formatting tools
447
- prettier: "formatting",
448
- "biome-format": "formatting",
449
- // Dead code detection
450
- knip: "deadCode",
451
- depcheck: "deadCode",
452
- // Documentation
453
- typedoc: "documentation",
454
- jsdoc: "documentation",
455
- alexandria: "documentation"
456
- };
457
841
  function isMetricConfigured(metricKey, lensesRan) {
458
- if (lensesRan === void 0) {
459
- return true;
460
- }
461
- if (lensesRan.length === 0) {
462
- return false;
463
- }
464
- return lensesRan.some((lensId) => LENS_TO_METRIC_MAP[lensId] === metricKey);
842
+ return isHexagonMetricConfigured(metricKey, lensesRan);
465
843
  }
466
844
  const getMetricConfig = (themeColors) => [
467
845
  {
@@ -1790,14 +2168,26 @@ const mockPackages = [
1790
2168
  }
1791
2169
  }
1792
2170
  ];
1793
- const METRIC_TO_COLOR_MODE = {
2171
+ const LEGACY_FALLBACKS = {
2172
+ linting: "eslint",
2173
+ formatting: "prettier",
1794
2174
  types: "typescript",
1795
- documentation: "alexandria",
1796
2175
  tests: "coverage",
1797
2176
  deadCode: "knip",
1798
- formatting: "prettier",
1799
- linting: "eslint"
2177
+ documentation: "alexandria"
1800
2178
  };
2179
+ function getColorModeForMetric(metric, lensesRan) {
2180
+ if (!isValidHexagonMetric(metric)) return null;
2181
+ const hexagonMetric = metric;
2182
+ const colorMode = getColorModeForHexagonMetric(hexagonMetric, lensesRan ?? []);
2183
+ if (!colorMode && lensesRan === void 0) {
2184
+ return LEGACY_FALLBACKS[hexagonMetric] ?? null;
2185
+ }
2186
+ return colorMode;
2187
+ }
2188
+ function isValidHexagonMetric(metric) {
2189
+ return metric in LEGACY_FALLBACKS;
2190
+ }
1801
2191
  const QualityHexagonPanelContent = ({
1802
2192
  context,
1803
2193
  events
@@ -2023,7 +2413,7 @@ const QualityHexagonPanelContent = ({
2023
2413
  });
2024
2414
  },
2025
2415
  onMetricClick: (metric) => {
2026
- const colorMode = METRIC_TO_COLOR_MODE[metric];
2416
+ const colorMode = getColorModeForMetric(metric, pkg.lensesRan);
2027
2417
  if (colorMode) {
2028
2418
  events.emit({
2029
2419
  type: "quality:colorMode:select",