Class: I18nLinter::Linter

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_linter/linter.rb

Instance Method Summary collapse

Constructor Details

#initialize(options, config) ⇒ Linter

Returns a new instance of Linter.



8
9
10
11
12
# File 'lib/i18n_linter/linter.rb', line 8

def initialize(options, config)
  @options = options
  @config = config
  @strings = []
end

Instance Method Details

#lint(filename:, file:) ⇒ Object



14
15
16
17
18
# File 'lib/i18n_linter/linter.rb', line 14

def lint(filename:, file:)
  parsed_file = tokenize_file(filename, file)
  find_strings(filename, parsed_file)
  compile(filename)
end

#show_errors(results) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/i18n_linter/linter.rb', line 20

def show_errors(results)
  puts
  results.each do |result|
    file = File.readlines(result.filename)
    line = result.line
    print_block(result, file, line)
  end
  puts
end