Sha256: a1c8933acfa2d218aa8b4a089222fcf284409e15b209994df3d0b57fbf98f875

Contents?: true

Size: 520 Bytes

Versions: 10

Compression:

Stored size: 520 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    class Offence
      attr_accessor :severity, :line_number, :message

      SEVERITIES = [:refactor, :convention, :warning, :error, :fatal]

      def initialize(severity, line_number, message)
        @severity = severity
        @line_number = line_number
        @message = message
      end

      def to_s
        "#{encode_severity}:%3d: #{message}" % [line_number]
      end

      def encode_severity
        @severity.to_s[0].upcase
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rubocop-0.4.6 lib/rubocop/cop/offence.rb
rubocop-0.4.5 lib/rubocop/cop/offence.rb
rubocop-0.4.4 lib/rubocop/cop/offence.rb
rubocop-0.4.3 lib/rubocop/cop/offence.rb
rubocop-0.4.2 lib/rubocop/cop/offence.rb
rubocop-0.4.1 lib/rubocop/cop/offence.rb
rubocop-0.4.0 lib/rubocop/cop/offence.rb
rubocop-0.3.2 lib/rubocop/cop/offence.rb
rubocop-0.3.1 lib/rubocop/cop/offence.rb
rubocop-0.3.0 lib/rubocop/cop/offence.rb