Class: RailsCodeHealth::HealthCalculator
- Inherits:
-
Object
- Object
- RailsCodeHealth::HealthCalculator
- Defined in:
- lib/rails_code_health/health_calculator.rb
Instance Method Summary collapse
- #calculate_scores(analysis_results) ⇒ Object
-
#initialize ⇒ HealthCalculator
constructor
A new instance of HealthCalculator.
Constructor Details
#initialize ⇒ HealthCalculator
Returns a new instance of HealthCalculator.
3 4 5 6 7 |
# File 'lib/rails_code_health/health_calculator.rb', line 3 def initialize @config = RailsCodeHealth.configuration @thresholds = @config.thresholds @weights = @thresholds['scoring_weights'] end |
Instance Method Details
#calculate_scores(analysis_results) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rails_code_health/health_calculator.rb', line 9 def calculate_scores(analysis_results) analysis_results.map do |file_result| health_score = calculate_file_health_score(file_result) file_result.merge( health_score: health_score, health_category: categorize_health(health_score), recommendations: generate_recommendations(file_result) ) end end |