Class: RailsArchitect::Analyzers::SolidAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_architect/analyzers/solid_analyzer.rb

Overview

Evaluates SOLID principles adherence in Rails projects

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_path = Rails.root) ⇒ SolidAnalyzer



9
10
11
# File 'lib/rails_architect/analyzers/solid_analyzer.rb', line 9

def initialize(project_path = Rails.root)
  @project_path = project_path
end

Instance Attribute Details

#project_pathObject (readonly)

Returns the value of attribute project_path.



7
8
9
# File 'lib/rails_architect/analyzers/solid_analyzer.rb', line 7

def project_path
  @project_path
end

Instance Method Details

#analyzeObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rails_architect/analyzers/solid_analyzer.rb', line 13

def analyze
  {
    score: calculate_solid_score,
    single_responsibility: analyze_single_responsibility,
    open_closed: analyze_open_closed,
    liskov_substitution: analyze_liskov,
    interface_segregation: analyze_interface_segregation,
    dependency_inversion: analyze_dependency_inversion,
    suggestions: generate_suggestions
  }
end