Sha256: 344cce6ded0d4ddcab07c75bea682970b2b4b22cc8b09d400bf6f816f632b249

Contents?: true

Size: 655 Bytes

Versions: 1

Compression:

Stored size: 655 Bytes

Contents

module Skeptic
  module Rules
    class NoSemicolons
      def initialize(enabled = false)
        @enabled = enabled
      end

      def apply_to(tokens, sexp)
        @locations = tokens.
          select { |location, type, token| token == ';' and type == :on_semicolon }.
          map { |location, type, token| location }
        self
      end

      def violations
        @locations.map do |line, column|
          "You have a semicolon at line #{line}, column #{column}"
        end
      end

      def name
        'No semicolons as expression separators'
      end

      def semicolon_locations
        @locations
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skeptic-0.0.0 lib/skeptic/rules/no_semicolons.rb