Module: Shirobai::Cop::Metrics::ComplexityShared
- Defined in:
- lib/shirobai/cop/metrics/complexity_shared.rb
Overview
Both complexity cops (‘CyclomaticComplexity`, `PerceivedComplexity`) need the same per-method analysis, so they share one bundle slot (`:complexity`): Rust computes both scores per method once and each cop selects its own metric. The per-file memoization lives in `Shirobai::Dispatch`.
Rust only returns the methods exceeding either cop’s ‘Max` (`cyclomatic > max || perceived > max`), so the compliant majority is never marshaled; each cop then re-checks its own metric exactly as before. Stock RuboCop touches non-exceeding methods nowhere (the `self.max =` ExcludeLimit bookkeeping only happens inside the offense path), so the prefilter is unobservable.
Constant Summary collapse
- CYCLOMATIC_BADGE =
RuboCop::Cop::Badge.parse("Metrics/CyclomaticComplexity")
- PERCEIVED_BADGE =
RuboCop::Cop::Badge.parse("Metrics/PerceivedComplexity")
Class Method Summary collapse
-
.bundle_args(config) ⇒ Object
Packed args for the bundled run: ‘[max_cyclomatic, max_perceived]`, the prefilter thresholds `Shirobai.check_complexity` receives.
Class Method Details
.bundle_args(config) ⇒ Object
Packed args for the bundled run: ‘[max_cyclomatic, max_perceived]`, the prefilter thresholds `Shirobai.check_complexity` receives.
25 26 27 |
# File 'lib/shirobai/cop/metrics/complexity_shared.rb', line 25 def bundle_args(config) [prefilter_max(config, CYCLOMATIC_BADGE), prefilter_max(config, PERCEIVED_BADGE)] end |