Sha256: c9ef36478fa4401d816b6098fcc30fb86af4b9a13b7b15e42ca2a71b00910b34

Contents?: true

Size: 737 Bytes

Versions: 5

Compression:

Stored size: 737 Bytes

Contents

# encoding: utf-8
module RailsBestPractices
  module Lexicals
    # Make sure there are no tabs in files.
    #
    # See the best practice details here http://rails-bestpractices.com/posts/2011/07/04/remove-tab/
    class RemoveTabCheck < Core::Check
      interesting_files ALL_FILES
      url "http://rails-bestpractices.com/posts/2011/07/04/remove-tab/"

      # check if the content of file contains a tab.
      #
      # @param [String] filename name of the file
      # @param [String] content content of the file
      def check(filename, content)
        if content =~ /\t/m
          line_no = $`.count("\n") + 1
          add_error("remove tab, use spaces instead", filename, line_no)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_best_practices-1.18.1 lib/rails_best_practices/lexicals/remove_tab_check.rb
rails_best_practices-1.18.0 lib/rails_best_practices/lexicals/remove_tab_check.rb
rails_best_practices-1.17.0 lib/rails_best_practices/lexicals/remove_tab_check.rb
rails_best_practices-1.16.0 lib/rails_best_practices/lexicals/remove_tab_check.rb
rails_best_practices-1.15.7 lib/rails_best_practices/lexicals/remove_tab_check.rb