Module: RailsCodeHealth

Defined in:
lib/rails_code_health.rb,
lib/rails_code_health/cli.rb,
lib/rails_code_health/version.rb,
lib/rails_code_health/ast_helpers.rb,
lib/rails_code_health/configuration.rb,
lib/rails_code_health/file_analyzer.rb,
lib/rails_code_health/ruby_analyzer.rb,
lib/rails_code_health/rails_analyzer.rb,
lib/rails_code_health/project_detector.rb,
lib/rails_code_health/report_generator.rb,
lib/rails_code_health/health_calculator.rb

Defined Under Namespace

Modules: ASTHelpers Classes: CLI, Configuration, Error, FileAnalyzer, HealthCalculator, ProjectDetector, RailsAnalyzer, ReportGenerator, RubyAnalyzer

Constant Summary collapse

VERSION =
"0.3.3"

Class Method Summary collapse

Class Method Details

.analyze(path = '.') ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rails_code_health.rb', line 23

def analyze(path = '.')
  project_path = Pathname.new(path).expand_path
  
  unless ProjectDetector.rails_project?(project_path)
    raise Error, "Not a Rails project directory: #{project_path}"
  end

  analyzer = FileAnalyzer.new(project_path)
  results = analyzer.analyze_all

  health_calculator = HealthCalculator.new
  scored_results = health_calculator.calculate_scores(results)

  ReportGenerator.new(scored_results).generate
end

.configurationObject



39
40
41
# File 'lib/rails_code_health.rb', line 39

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



43
44
45
# File 'lib/rails_code_health.rb', line 43

def configure
  yield(configuration) if block_given?
end