Sha256: d260876ef41d3941a16be474f96722c89f0a84c9d2b307957bf80b51ee3d9545

Contents?: true

Size: 868 Bytes

Versions: 25

Compression:

Stored size: 868 Bytes

Contents

# encoding: utf-8
module RailsBestPractices
  module Core
    # Error is the violation to rails best practice.
    #
    # it indicates the filenname, line number and error message for the violation.
    class Error < CodeAnalyzer::Warning
      attr_reader :type, :url
      attr_accessor :git_commit, :git_username, :hg_commit, :hg_username

      def initialize(options={})
        super
        @type = options[:type]
        @url = options[:url]
        @git_commit = options[:git_commit]
        @git_username = options[:git_username]
        @hg_commit = options[:hg_commit]
        @hg_username = options[:hg_username]
      end

      def short_filename
        File.expand_path(filename)[File.expand_path(Core::Runner.base_path).size..-1].sub(/^\//, '')
      end

      def first_line_number
        line_number.split(',').first
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
rails_best_practices-1.19.1 lib/rails_best_practices/core/error.rb
rails_best_practices-1.19.0 lib/rails_best_practices/core/error.rb
rails_best_practices-1.18.1 lib/rails_best_practices/core/error.rb
rails_best_practices-1.18.0 lib/rails_best_practices/core/error.rb
rails_best_practices-1.17.0 lib/rails_best_practices/core/error.rb
rails_best_practices-1.16.0 lib/rails_best_practices/core/error.rb
rails_best_practices-1.15.7 lib/rails_best_practices/core/error.rb
rails_best_practices-1.15.6 lib/rails_best_practices/core/error.rb
rails_best_practices-1.15.4 lib/rails_best_practices/core/error.rb
rails_best_practices-1.15.3 lib/rails_best_practices/core/error.rb
rails_best_practices-1.15.2 lib/rails_best_practices/core/error.rb
rails_best_practices-1.15.1 lib/rails_best_practices/core/error.rb
rails_best_practices-1.14.4 lib/rails_best_practices/core/error.rb
rails_best_practices-1.14.3 lib/rails_best_practices/core/error.rb
rails_best_practices-1.14.2 lib/rails_best_practices/core/error.rb
rails_best_practices-1.14.1 lib/rails_best_practices/core/error.rb
rails_best_practices-1.14.0 lib/rails_best_practices/core/error.rb
rails_best_practices-1.13.8 lib/rails_best_practices/core/error.rb
rails_best_practices-1.13.5 lib/rails_best_practices/core/error.rb
rails_best_practices-1.13.4 lib/rails_best_practices/core/error.rb