Sha256: f145a6e6dff849f752d2508d555ff187dbf62ac1bbfd96aa37c41380dd9d8909
Contents?: true
Size: 756 Bytes
Versions: 3
Compression:
Stored size: 756 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Layout # This cop looks for trailing whitespace in the source code. class TrailingWhitespace < Cop MSG = 'Trailing whitespace detected.'.freeze def investigate(processed_source) processed_source.lines.each_with_index do |line, index| next unless line.end_with?(' ', "\t") range = source_range(processed_source.buffer, index + 1, (line.rstrip.length)...(line.length)) add_offense(range, range) end end def autocorrect(range) ->(corrector) { corrector.remove(range) } end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.50.0 | lib/rubocop/cop/layout/trailing_whitespace.rb |
rubocop-0.49.1 | lib/rubocop/cop/layout/trailing_whitespace.rb |
rubocop-0.49.0 | lib/rubocop/cop/layout/trailing_whitespace.rb |