Module: Rubocop::Cop::Lint::Syntax

Defined in:
lib/rubocop/cop/lint/syntax.rb

Overview

This is actually not a cop and inspects nothing. It just provides methods to repack Parser's diagnostics into RuboCop's offenses.

Constant Summary collapse

COP_NAME =
'Syntax'.freeze

Class Method Summary collapse

Class Method Details

.offense_from_diagnostic(diagnostic) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/rubocop/cop/lint/syntax.rb', line 17

def self.offense_from_diagnostic(diagnostic)
  Offense.new(
    diagnostic.level,
    diagnostic.location,
    diagnostic.message,
    COP_NAME
  )
end

.offenses_from_diagnostics(diagnostics) ⇒ Object



11
12
13
14
15
# File 'lib/rubocop/cop/lint/syntax.rb', line 11

def self.offenses_from_diagnostics(diagnostics)
  diagnostics.map do |diagnostic|
    offense_from_diagnostic(diagnostic)
  end
end