Sha256: a0fe12574ca609f16641a222bdb7b0daefd9d42dc87e9cbad5e7332a0ee5e6e2

Contents?: true

Size: 721 Bytes

Versions: 5

Compression:

Stored size: 721 Bytes

Contents

module Warder
  # responsible for run coffeescript style guide validation
  class CoffeeLintRunner
    # responsible for human readable error message representation
    class MessageLineFormatter
      MESSAGE_KEY = 'message'.freeze
      CONTEXT_KEY = 'context'.freeze
      LEVEL_KEY = 'level'.freeze
      LINE_NUMBER_KEY = 'lineNumber'.freeze

      def initialize(result)
        @result = result
      end

      def format
        msg = [@result[MESSAGE_KEY], @result[CONTEXT_KEY]].join('. ')
        [level, line_number, msg].join(': ')
      end

      private

      def line_number
        "##{@result[LINE_NUMBER_KEY]}"
      end

      def level
        @result[LEVEL_KEY].upcase
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
warder-0.3.4 lib/warder/coffee_lint_runner/message_line_formatter.rb
warder-0.3.2 lib/warder/coffee_lint_runner/message_line_formatter.rb
warder-0.3.1 lib/warder/coffee_lint_runner/message_line_formatter.rb
warder-0.3.0 lib/warder/coffee_lint_runner/message_line_formatter.rb
warder-0.2.4 lib/warder/coffee_lint_runner/message_line_formatter.rb