Sha256: e94f58eea1562ce23c115144daf09c829f59b9db230e221357fcfb1dd0d59d1f
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
require_relative '../ruler' class Tailor module Rulers class AllowTrailingLineSpacesRuler < Tailor::Ruler def ignored_nl_update(lexed_line, lineno, column) log "Last event: #{lexed_line.last_non_line_feed_event}" log "Line ends with space: #{lexed_line.ends_with_sp?}" measure(lexed_line, lineno, column) end def nl_update(lexed_line, lineno, column) ignored_nl_update(lexed_line, lineno, column) end # Checks to see if the line contains trailing spaces. # # @param [LexedLine] lexed_line The line to check for trailing spaces. # @param [Fixnum] lineno Line the potential problem is on. # @param [Fixnum] column Column the potential problem is on. def measure(lexed_line, lineno, column) if lexed_line.ends_with_sp? options = { actual_trailing_spaces: lexed_line.last_non_line_feed_event.last.size } @problems << Problem.new(:trailing_spaces, lineno, column, options) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tailor-1.0.0.alpha2 | lib/tailor/rulers/allow_trailing_line_spaces_ruler.rb |
tailor-1.0.0.alpha | lib/tailor/rulers/allow_trailing_line_spaces_ruler.rb |