Sha256: 7c9364a2a4406e844005028d488eddce307987e99d3ca89028ddade5d82f3c3f
Contents?: true
Size: 684 Bytes
Versions: 14
Compression:
Stored size: 684 Bytes
Contents
module Skeptic module Rules class NoTrailingWhitespace DESCRIPTION = 'Disallows trailing whitespace' attr_reader :lines_with_trailing_whitespace def initialize(enable = false) @lines_with_trailing_whitespace = [] end def apply_to(code, tokens, sexp) code.lines.each_with_index do |line, index| @lines_with_trailing_whitespace << index + 1 if line.chomp =~ /\s+$/ end self end def violations @lines_with_trailing_whitespace.map do |line| "Line #{line} has trailing whitespace" end end def name "Trailing whitespace" end end end end
Version data entries
14 entries across 14 versions & 1 rubygems