Class: Overcommit::GitHook::AuthorName

Inherits:
HookSpecificCheck show all
Includes:
HookRegistry
Defined in:
lib/overcommit/plugins/pre_commit/author_name.rb

Instance Method Summary collapse

Methods included from HookRegistry

included

Methods inherited from HookSpecificCheck

friendly_name, #initialize, #name, required!, #skip?, skippable?, #staged, stealth!, #stealth?

Constructor Details

This class inherits a constructor from Overcommit::GitHook::HookSpecificCheck

Instance Method Details

#run_checkObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/overcommit/plugins/pre_commit/author_name.rb', line 5

def run_check
  name = `git config --get user.name`.chomp
  unless name.split(' ').count >= 2
    return :bad, "Author must have at least first and last name; " <<
                 "was: '#{name}'.\n Set your name with " <<
                 "`git config --global user.name 'Your Name'`"
  end

  :good
end