Class: RubyLsp::Reek::Runner
- Inherits:
-
Object
- Object
- RubyLsp::Reek::Runner
- Includes:
- RubyLsp::Requests::Support::Formatter
- Defined in:
- lib/ruby_lsp/reek/runner.rb
Overview
Implements Ruby LSP Formatter interface: specifically run_diagnostic
Instance Method Summary collapse
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #run_diagnostic(uri, document) ⇒ Object
-
#run_formatting(_uri, document) ⇒ String
We are not implementing this method, but it is required by the interface.
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
11 12 13 |
# File 'lib/ruby_lsp/reek/runner.rb', line 11 def initialize @config = ::Reek::Configuration::AppConfiguration.from_default_path end |
Instance Method Details
#run_diagnostic(uri, document) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/ruby_lsp/reek/runner.rb', line 26 def run_diagnostic(uri, document) return [] if config.path_excluded?(Pathname.new(uri.path)) examiner = ::Reek::Examiner.new(document.source, configuration: config) examiner.smells.map { |smell| warning_to_diagnostic(smell) } end |
#run_formatting(_uri, document) ⇒ String
We are not implementing this method, but it is required by the interface
20 21 22 |
# File 'lib/ruby_lsp/reek/runner.rb', line 20 def run_formatting(_uri, document) document.source end |