Class: Overcommit::Hook::CommitMsg::TextWidth
- Defined in:
- lib/overcommit/hook/commit_msg/text_width.rb
Overview
Ensures the number of columns the subject and commit message lines occupy is under the preferred limits.
Instance Method Summary collapse
Methods inherited from Base
#applicable_files, #command, #description, #enabled?, #in_path?, #initialize, #name, #quiet?, #required?, #run?, #skip?
Constructor Details
This class inherits a constructor from Overcommit::Hook::Base
Instance Method Details
#run ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/overcommit/hook/commit_msg/text_width.rb', line 5 def run if .first.size > 60 return :warn, 'Please keep the subject < ~60 characters' end .each do |line| chomped = line.chomp if chomped.size > 72 return :warn, "> 72 characters, please hard wrap: '#{chomped}'" end end :good end |