Sha256: 98e07979b89ee1e1f7585d240d39c690851926a6879673ab73e2732f0ee0af62

Contents?: true

Size: 820 Bytes

Versions: 10

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

10 entries across 10 versions & 1 rubygems

Version Path
tailor-1.2.1 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.2.0 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.1.5 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.1.4 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.1.3 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.1.2 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.1.1 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.1.0 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.0.1 lib/tailor/rulers/allow_hard_tabs_ruler.rb
tailor-1.0.0 lib/tailor/rulers/allow_hard_tabs_ruler.rb