Sha256: 4541311d24473faf3f23dfc4bbee62883c4a67d5c1cf93118358b821a28b0780

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

module SimpleCovLinterFormatter
  class SourceFileFormatter
    FILE_COLUMN = 1

    def initialize(source_file)
      @source_file = source_file
    end

    def format
      lines.map do |line|
        build_message(line)
      end
    end

    private

    def build_message(line)
      [
        @source_file.filename,
        line.line_number,
        FILE_COLUMN,
        "#{line.status}-#{lines_count}"
      ].map(&:to_s).join(":")
    end

    def lines_count
      @lines_count ||= lines.count
    end

    def lines
      @lines ||= @source_file.lines
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simplecov_linter_formatter-0.1.0 lib/simplecov_linter_formatter/formatters/source_file_formatter.rb