Sha256: 899b8edde0e4a8c6bd392d5758d8f82445765e49fe7dadd5716bd7fd33c50e94

Contents?: true

Size: 507 Bytes

Versions: 21

Compression:

Stored size: 507 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 :fail,
               "Author has an invalid email address: '#{email}'\n" \
               'Set your email with ' \
               '`git config --global user.email your_email@example.com`'
      end

      :pass
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
overcommit-0.32.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.32.0.rc1 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.31.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.30.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.29.1 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.29.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.28.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.27.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.26.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.25.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.24.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.23.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.22.0 lib/overcommit/hook/pre_commit/author_email.rb
jawshooah-overcommit-0.22.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.21.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.20.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.19.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.18.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.17.0 lib/overcommit/hook/pre_commit/author_email.rb
overcommit-0.16.0 lib/overcommit/hook/pre_commit/author_email.rb