Class: Hashira::Pipeline
- Inherits:
-
Object
- Object
- Hashira::Pipeline
- Defined in:
- lib/hashira/pipeline.rb
Constant Summary collapse
- ANALYZERS =
%i[coupling complexity duplication smells].freeze
- STRUCTURAL =
Hashira::Coupling::Report::RULES.map { it::KIND }.freeze
- SMELLS =
( Hashira::Smells::Report::CHECKS.map(&:kind) + [Hashira::Smells::BoundarySprawl::KIND] ).sort.freeze
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #analyzed(name, kind, *extra) ⇒ Object
- #churn ⇒ Object
- #complexity ⇒ Object
- #duplication ⇒ Object
- #enabled?(analyzer) ⇒ Boolean
- #findings ⇒ Object
- #graph ⇒ Object
- #hotspots ⇒ Object
-
#initialize(project, enabled: ANALYZERS, packaging: :auto) ⇒ Pipeline
constructor
A new instance of Pipeline.
- #smells ⇒ Object
- #unparsed ⇒ Object
Constructor Details
#initialize(project, enabled: ANALYZERS, packaging: :auto) ⇒ Pipeline
Returns a new instance of Pipeline.
16 17 18 19 20 21 |
# File 'lib/hashira/pipeline.rb', line 16 def initialize(project, enabled: ANALYZERS, packaging: :auto) @project = project @enabled = enabled @parsed = Hashira::Trees.new(project) @coupling = Hashira::Coupling::Report.new(project, @parsed.all, packaging: settle(packaging)) end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
23 24 25 |
# File 'lib/hashira/pipeline.rb', line 23 def project @project end |
Instance Method Details
#analyzed(name, kind, *extra) ⇒ Object
43 44 45 |
# File 'lib/hashira/pipeline.rb', line 43 def analyzed(name, kind, *extra) kind.new(@project, @parsed.all, *extra) if enabled?(name) end |
#churn ⇒ Object
39 |
# File 'lib/hashira/pipeline.rb', line 39 def churn = @churn ||= Hashira::Churn.scan(@project.directories.first) |
#complexity ⇒ Object
29 |
# File 'lib/hashira/pipeline.rb', line 29 def complexity = @complexity ||= analyzed(:complexity, Hashira::Complexity::Scores) |
#duplication ⇒ Object
31 |
# File 'lib/hashira/pipeline.rb', line 31 def duplication = @duplication ||= analyzed(:duplication, Hashira::Duplication::Clones, churn) |
#enabled?(analyzer) ⇒ Boolean
41 |
# File 'lib/hashira/pipeline.rb', line 41 def enabled?(analyzer) = @enabled.include?(analyzer) |
#findings ⇒ Object
47 |
# File 'lib/hashira/pipeline.rb', line 47 def findings = structural + listed(complexity) + listed(duplication) + listed(smells) |
#graph ⇒ Object
27 |
# File 'lib/hashira/pipeline.rb', line 27 def graph = @coupling.graph |
#hotspots ⇒ Object
35 36 37 |
# File 'lib/hashira/pipeline.rb', line 35 def hotspots @hotspots ||= Hashira::Hotspots::Rollup.new(complexity, duplication, churn) if complexity || duplication end |
#smells ⇒ Object
33 |
# File 'lib/hashira/pipeline.rb', line 33 def smells = @smells ||= analyzed(:smells, Hashira::Smells::Report) |
#unparsed ⇒ Object
25 |
# File 'lib/hashira/pipeline.rb', line 25 def unparsed = @parsed.unparsed |