Class: MetzScan::Analyzers::RepeatedBranching
- Inherits:
-
Object
- Object
- MetzScan::Analyzers::RepeatedBranching
- Includes:
- ProjectAnalyzerTriage
- Defined in:
- lib/metz_scan/analyzers/repeated_branching.rb,
lib/metz_scan/analyzers/repeated_branching/triage.rb,
lib/metz_scan/analyzers/repeated_branching/branch_value.rb,
lib/metz_scan/analyzers/repeated_branching/predicate_chain.rb,
lib/metz_scan/analyzers/repeated_branching/decision_subject.rb,
lib/metz_scan/analyzers/repeated_branching/branch_site_collector.rb,
lib/metz_scan/analyzers/repeated_branching/contextual_node_walker.rb
Overview
Groups repeated case/if branching decisions across indexed Ruby files.
Defined Under Namespace
Modules: Triage Classes: BranchSiteCollector, BranchValue, DecisionSubject, Finding, PredicateChain
Constant Summary collapse
- RULE_ID =
"MetzProject/RepeatedBranching"- PROJECT_ANALYZER_STATUS =
"validated"- DEFAULT_OUTPUT_ELIGIBLE =
true- CONFIDENCE =
"medium"- TRIAGE_SEVERITY =
"design pressure"- TRIAGE_SUMMARY =
"Validated repeated-decision signal; review repeated decisions in context."- WHY =
"Repeated branching spreads one domain decision across files and makes change ripple outward."- SUGGESTED_NEXT_MOVES =
[ "Name the domain decision once and reuse it instead of repeating the same branch table.", "Consider polymorphism, a strategy object, or a small lookup object when the branch represents type behavior." ].freeze
- ContextualNodeWalker =
MetzScan::Analyzers::ContextualNodeWalker
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(paths: nil, index: nil, minimum_occurrences: 2) ⇒ RepeatedBranching
constructor
A new instance of RepeatedBranching.
Constructor Details
#initialize(paths: nil, index: nil, minimum_occurrences: 2) ⇒ RepeatedBranching
Returns a new instance of RepeatedBranching.
41 42 43 44 45 |
# File 'lib/metz_scan/analyzers/repeated_branching.rb', line 41 def initialize(paths: nil, index: nil, minimum_occurrences: 2) @paths = Array(paths) @index = index @minimum_occurrences = minimum_occurrences end |
Instance Method Details
#call ⇒ Object
47 48 49 |
# File 'lib/metz_scan/analyzers/repeated_branching.rb', line 47 def call grouped_sites.filter_map { |_signature, sites| finding_for(sites) } end |