UNPKG

@mkpro118/semantic-change-detector

Version:

Semantic change detection for TypeScript and TSX code with GitHub Actions integration

100 lines 4.73 kB
import type { SemanticChangeType, SeverityLevel } from './index.js'; /** * Configuration groups that logically organize change kinds for easier management. * Each group can be enabled/disabled as a unit, with fine-grained overrides available. */ export type ChangeKindGroup = 'core-structural' | 'data-flow' | 'control-flow' | 'react-hooks' | 'jsx-rendering' | 'jsx-logic' | 'imports-exports' | 'async-patterns' | 'type-system' | 'side-effects' | 'complexity' | 'error-handling'; /** * Maps change kinds to their logical groups for organization and bulk control. */ export declare const CHANGE_KIND_GROUPS: Record<ChangeKindGroup, SemanticChangeType[]>; /** * Default severity assignments for each change kind. * These represent the baseline production-ready severity levels. */ export declare const DEFAULT_CHANGE_SEVERITIES: Record<SemanticChangeType, SeverityLevel>; /** * Analyzer configuration with granular control over change detection, * severity overrides, and group-based enabling/disabling. */ export type AnalyzerConfig = { /** Glob patterns to include in analysis. */ include: string[]; /** Glob patterns to exclude from analysis. */ exclude: string[]; /** Patterns of callees considered side-effectful. */ sideEffectCallees: string[]; /** Glob patterns for modules considered to have side effects. */ sideEffectModules: string[]; /** Glob patterns matching test files. */ testGlobs: string[]; /** Labels that permit skipping tests. */ bypassLabels: string[]; /** Optional per-file timeout in milliseconds. */ timeoutMs: number; /** Optional soft memory cap in MB. */ maxMemoryMB: number; /** Control which change kind groups are enabled/disabled. */ changeKindGroups: { /** Groups that are enabled (default: all enabled). */ enabled: ChangeKindGroup[]; /** Groups that are explicitly disabled (takes precedence over enabled). */ disabled: ChangeKindGroup[]; }; /** Override default severities for specific change kinds. */ severityOverrides: Partial<Record<SemanticChangeType, SeverityLevel>>; /** Disable specific change kinds regardless of group settings. */ disabledChangeKinds: SemanticChangeType[]; /** JSX-specific configuration controls. */ jsxConfig: { /** Enable/disable JSX analysis entirely. */ enabled: boolean; /** Disable JSX logic analysis (conditional rendering, etc.) but keep structural changes. */ ignoreLogicChanges: boolean; /** Treat all JSX changes as low severity (useful for teams that don't test JSX logic). */ treatAsLowSeverity: boolean; /** Minimum complexity threshold for JSX event handlers to be flagged. */ eventHandlerComplexityThreshold: number; }; /** Performance optimization settings. */ performance: { /** Skip analysis for change kinds in disabled groups (true) or run but filter results (false). */ skipDisabledAnalyzers: boolean; /** Enable early exit optimizations when no changes detected in a group. */ enableEarlyExit: boolean; }; /** Test requirement configuration. */ testRequirements: { /** Change kinds that always require tests regardless of severity. */ alwaysRequireTests: SemanticChangeType[]; /** Change kinds that never require tests regardless of severity. */ neverRequireTests: SemanticChangeType[]; /** Minimum severity level to require tests (overrides individual change settings). */ minimumSeverityForTests: SeverityLevel | null; }; }; /** * Default configuration with production-ready settings. */ export declare const DEFAULT_CONFIG: AnalyzerConfig; /** * Resolves the effective severity for a change kind, considering config overrides. */ export declare function getEffectiveSeverity(changeKind: SemanticChangeType, config: AnalyzerConfig): SeverityLevel; /** * Checks if a change kind is enabled based on group and individual settings. */ export declare function isChangeKindEnabled(changeKind: SemanticChangeType, config: AnalyzerConfig): boolean; /** * Determines if tests should be required for a specific change based on configuration. */ export declare function shouldRequireTestsForChange(changeKind: SemanticChangeType, severity: SeverityLevel, config: AnalyzerConfig): boolean; /** * Gets all change kinds in a specific group. */ export declare function getChangeKindsInGroup(group: ChangeKindGroup): SemanticChangeType[]; /** * Gets the group that a change kind belongs to. */ export declare function getGroupForChangeKind(changeKind: SemanticChangeType): ChangeKindGroup | null; //# sourceMappingURL=config.d.ts.map