Class: Hashira::Complexity::Analyzer
- Inherits:
-
Object
- Object
- Hashira::Complexity::Analyzer
- Defined in:
- lib/hashira/complexity/analyzer.rb
Constant Summary collapse
- THRESHOLD =
10
Instance Method Summary collapse
- #classes ⇒ Object
- #findings ⇒ Object
-
#initialize(project, trees) ⇒ Analyzer
constructor
A new instance of Analyzer.
- #methods ⇒ Object
Constructor Details
#initialize(project, trees) ⇒ Analyzer
Returns a new instance of Analyzer.
8 9 10 11 |
# File 'lib/hashira/complexity/analyzer.rb', line 8 def initialize(project, trees) @project = project @scores = trees.flat_map { |path, tree| scores_for(path, tree) } end |
Instance Method Details
#classes ⇒ Object
15 |
# File 'lib/hashira/complexity/analyzer.rb', line 15 def classes = Rollup.new(@scores).classes.sort_by { -it.cognitive } |
#findings ⇒ Object
17 |
# File 'lib/hashira/complexity/analyzer.rb', line 17 def findings = flagged.map { MethodFinding.new(it).to_finding } |
#methods ⇒ Object
13 |
# File 'lib/hashira/complexity/analyzer.rb', line 13 def methods = @scores.sort_by { -it.cognitive } |