Sha256: a6dcf0d066cc735c887e63ba0ba9738c92b58b0654eaa82fc505d2522e5dd4d4
Contents?: true
Size: 803 Bytes
Versions: 9
Compression:
Stored size: 803 Bytes
Contents
# encoding: utf-8 require 'rails_best_practices/core/check' module RailsBestPractices module Lexicals # Make sure there are no trailing whitespace in codes. # # See the best practice details here http://rails-bestpractices.com/posts/60-remove-trailing-whitespace class RemoveTrailingWhitespaceCheck < Core::Check url "http://rails-bestpractices.com/posts/60-remove-trailing-whitespace" # check if the content of file contain a trailing whitespace. # # @param [String] filename name of the file # @param [String] content content of the file def check(filename, content) if content =~ / +\n/m line_no = $`.count("\n") + 1 add_error("remove trailing whitespace", filename, line_no) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems