Sha256: ee2517b490558ec4aaba440cf0172edf3a28a8381ae7bbf9b87a5f73c6a3cf34

Contents?: true

Size: 820 Bytes

Versions: 4

Compression:

Stored size: 820 Bytes

Contents

require_relative '../ruler'

class Tailor
  module Rulers
    class AllowHardTabsRuler < Tailor::Ruler
      def initialize(config, options)
        super(config, options)
        add_lexer_observers :sp
      end

      def sp_update(token, lineno, column)
        measure(token, lineno, column)
      end

      # Checks to see if the space(s) contains hard tabs.
      #
      # @param [Fixnum] token The space(s).
      # @param [Fixnum] lineno Line the problem was found on.
      # @param [Fixnum] column Column the problem was found on.
      def measure(token, lineno, column)
        if token.contains_hard_tab?
          problem_message = 'Hard tab found.'

          @problems << Problem.new(problem_type, lineno, column,
            problem_message, @options[:level])
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tailor-1.4.1 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.4.0 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.3.1 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.3.0 lib/tailor/rulers/allow_hard_tabs_ruler.rb