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 { Hashira::Smells::Kind.new(it).to_s } + [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
- #focus ⇒ Object
- #graph ⇒ Object
- #hotspots ⇒ Object
-
#initialize(project, enabled: ANALYZERS, packaging: :auto, only: []) ⇒ Pipeline
constructor
A new instance of Pipeline.
- #smells ⇒ Object
- #unparsed ⇒ Object
- #verify ⇒ Object
Constructor Details
#initialize(project, enabled: ANALYZERS, packaging: :auto, only: []) ⇒ 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, only: []) @project = project @enabled = enabled @packaging = packaging @only = only 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
48 49 50 |
# File 'lib/hashira/pipeline.rb', line 48 def analyzed(name, kind, *extra) kind.new(@project, parsed.all, *extra) if enabled?(name) end |
#churn ⇒ Object
44 |
# File 'lib/hashira/pipeline.rb', line 44 def churn = @_churn ||= Hashira::Churn.build(@project.directories.first) |
#complexity ⇒ Object
34 |
# File 'lib/hashira/pipeline.rb', line 34 def complexity = @_complexity ||= analyzed(:complexity, Hashira::Complexity::Scores) |
#duplication ⇒ Object
36 |
# File 'lib/hashira/pipeline.rb', line 36 def duplication = @_duplication ||= analyzed(:duplication, Hashira::Duplication::Clones, churn) |
#enabled?(analyzer) ⇒ Boolean
46 |
# File 'lib/hashira/pipeline.rb', line 46 def enabled?(analyzer) = @enabled.include?(analyzer) |
#findings ⇒ Object
52 |
# File 'lib/hashira/pipeline.rb', line 52 def findings = focus.narrow(structural + listed(complexity) + listed(duplication) + listed(smells)) |
#focus ⇒ Object
54 |
# File 'lib/hashira/pipeline.rb', line 54 def focus = @_focus ||= Hashira::Focus.new(@project, @only) |
#graph ⇒ Object
32 |
# File 'lib/hashira/pipeline.rb', line 32 def graph = coupling.graph |
#hotspots ⇒ Object
40 41 42 |
# File 'lib/hashira/pipeline.rb', line 40 def hotspots @_hotspots ||= Hashira::Hotspots::Rollup.new(complexity, duplication, churn) if complexity || duplication end |
#smells ⇒ Object
38 |
# File 'lib/hashira/pipeline.rb', line 38 def smells = @_smells ||= analyzed(:smells, Hashira::Smells::Report, boundaries) |
#unparsed ⇒ Object
30 |
# File 'lib/hashira/pipeline.rb', line 30 def unparsed = parsed.unparsed |
#verify ⇒ Object
25 26 27 28 |
# File 'lib/hashira/pipeline.rb', line 25 def verify boundaries.interpreted self end |