Sha256: e3f44618eb08cb705bd395bbff874335bee773fa1c9787df47582f3202d9acf0

Contents?: true

Size: 504 Bytes

Versions: 9

Compression:

Stored size: 504 Bytes

Contents

module Overcommit::Hook::PreCommit
  # Checks the format of an author's email address.
  class AuthorEmail < Base
    def run
      result = execute(%w[git config --get user.email])
      email = result.stdout.chomp

      unless email =~ /#{@config['pattern']}/
        return :bad, "Author has an invalid email address: '#{email}'\n" \
                     'Set your email with ' \
                     '`git config --global user.email your_email@example.com`'
      end

      :good
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
overcommit-0.14.1 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.14.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.13.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.12.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.11.1 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.11.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.10.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.9.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.8.0 lib/overcommit/hook/pre_commit/author_email.rb