Sha256: c5aa36728efa85f549b4554e703f23c8dfb9e9bab843e3373debb34e303abd9d
Contents?: true
Size: 860 Bytes
Versions: 1
Compression:
Stored size: 860 Bytes
Contents
require 'solargraph' require 'solargraph-reek/version' require 'reek' module Solargraph module Reek class Reporter < Solargraph::Diagnostics::Base def diagnose source, _api_map examiner = ::Reek::Examiner.new(source.code.dup) examiner.smells.map { |w| warning_to_diagnostic(w) } rescue ::Reek::Errors::SyntaxError [] end private # @param warning [::Reek::SmellWarning] # @return [Hash] def warning_to_diagnostic(warning) { range: Solargraph::Range.from_to(warning.lines.first - 1, 0, warning.lines.last, 0).to_hash, severity: Diagnostics::Severities::WARNING, source: 'Reek', message: "[#{warning.smell_type}] #{warning.message}" } end end end end Solargraph::Diagnostics.register 'reek', Solargraph::Reek::Reporter
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solargraph-reek-0.1.0 | lib/solargraph-reek.rb |