Sha256: ca2d7afda7221eb38da099fd4535be65248cf29d1ecaf376e8f5e220ef5930ab

Contents?: true

Size: 884 Bytes

Versions: 7

Compression:

Stored size: 884 Bytes

Contents

# frozen_string_literal: true

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(%r{^/}, '')
      end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_best_practices-1.23.2 lib/rails_best_practices/core/error.rb
rails_best_practices-1.23.1 lib/rails_best_practices/core/error.rb
rails_best_practices-1.23.0 lib/rails_best_practices/core/error.rb
rails_best_practices-1.22.1 lib/rails_best_practices/core/error.rb
rails_best_practices-1.22.0 lib/rails_best_practices/core/error.rb
rails_best_practices-1.21.0 lib/rails_best_practices/core/error.rb
rails_best_practices-1.20.1 lib/rails_best_practices/core/error.rb