Class: Solargraph::Reek::Reporter

Inherits:
Diagnostics::Base
  • Object
show all
Defined in:
lib/solargraph-reek.rb

Instance Method Summary collapse

Instance Method Details

#diagnose(source, _api_map) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/solargraph-reek.rb', line 9

def diagnose(source, _api_map)
  configuration = ::Reek::Configuration::AppConfiguration.from_default_path
  source_pathname = Pathname.new(source.filename)

  return [] if configuration.path_excluded?(source_pathname)

  examiner = ::Reek::Examiner.new(source_pathname, configuration: configuration)
  examiner.smells.map { |w| warning_to_diagnostic(w) }
rescue ::Reek::Errors::SyntaxError
  []
end