Files

Class/Module Index [+]

Quicksearch

RuboCop::Formatter::ClangStyleFormatter

This formatter formats report data in clang style. The precise location of the problem is shown together with the relevant source code.

Public Instance Methods

highlight_line(location) click to toggle source
# File lib/rubocop/formatter/clang_style_formatter.rb, line 22
def highlight_line(location)
  column_length = if location.begin.line == location.end.line
                    location.column_range.count
                  else
                    location.source_line.length - location.column
                  end

  ' ' * location.column + '^' * column_length
end
report_file(file, offenses) click to toggle source
# File lib/rubocop/formatter/clang_style_formatter.rb, line 8
def report_file(file, offenses)
  offenses.each do |o|
    output.printf("%s:%d:%d: %s: %s\n",
                  cyan(smart_path(file)), o.line, o.real_column,
                  colored_severity_code(o), message(o))

    source_line = o.location.source_line
    next if source_line.blank?

    output.puts(source_line)
    output.puts(highlight_line(o.location))
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.