Class: Hashira::Pipeline
- Inherits:
-
Object
- Object
- Hashira::Pipeline
- Defined in:
- lib/hashira/pipeline.rb
Constant Summary collapse
- ANALYZERS =
%i[coupling complexity duplication].freeze
- RULES =
[Analysis::CycleFindings, Analysis::SdpViolationFindings].freeze
Instance Attribute Summary collapse
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #churn ⇒ Object
- #complexity ⇒ Object
- #duplication ⇒ Object
- #enabled?(analyzer) ⇒ Boolean
- #findings ⇒ Object
- #hotspots ⇒ Object
-
#initialize(project, enabled: ANALYZERS) ⇒ Pipeline
constructor
A new instance of Pipeline.
Constructor Details
#initialize(project, enabled: ANALYZERS) ⇒ Pipeline
Returns a new instance of Pipeline.
11 12 13 14 15 16 |
# File 'lib/hashira/pipeline.rb', line 11 def initialize(project, enabled: ANALYZERS) @project = project @enabled = enabled @trees = project.files.to_h { [it, parse(it)] } @graph = Analysis::Graph.new(project, @trees, Analysis::Census.new(project, @trees)) end |
Instance Attribute Details
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
18 19 20 |
# File 'lib/hashira/pipeline.rb', line 18 def graph @graph end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
18 19 20 |
# File 'lib/hashira/pipeline.rb', line 18 def project @project end |
Instance Method Details
#complexity ⇒ Object
20 21 22 |
# File 'lib/hashira/pipeline.rb', line 20 def complexity @complexity ||= Complexity::Analyzer.new(@project, @trees) if enabled?(:complexity) end |
#duplication ⇒ Object
24 25 26 |
# File 'lib/hashira/pipeline.rb', line 24 def duplication @duplication ||= Duplication::Analyzer.new(@project, @trees, churn) if enabled?(:duplication) end |
#enabled?(analyzer) ⇒ Boolean
34 |
# File 'lib/hashira/pipeline.rb', line 34 def enabled?(analyzer) = @enabled.include?(analyzer) |
#findings ⇒ Object
36 |
# File 'lib/hashira/pipeline.rb', line 36 def findings = coupling_findings + listed(complexity) + listed(duplication) |