Sha256: 7be6af536fef32c326dc901d7e1bbf3e836a361ab2d6f314974ea8bf1742df5a

Contents?: true

Size: 583 Bytes

Versions: 18

Compression:

Stored size: 583 Bytes

Contents

module Overcommit::GitHook
  class ReleaseNote < HookSpecificCheck
    include HookRegistry

    EMPTY_RELEASE_NOTE = /^release notes?\s*[:.]?\n{2,}/im
    def run_check
      if commit_message.join =~ EMPTY_RELEASE_NOTE
        strip_release_note
        return :warn, 'Empty release note found, automatically removed'
      end

      :good
    end

  private

    def strip_release_note
      stripped_message = commit_message.join.sub(EMPTY_RELEASE_NOTE, '')

      ::File.open(commit_message_file, 'w') do |file|
        file.write(stripped_message)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
overcommit-0.5.0 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.4.1 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.4.0 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.3.2 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.3.1 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.3.0 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.2.6 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.2.5 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.2.4 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.2.3 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.2.2 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.2.1 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.2.0 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.1.11 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.1.10 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.1.9 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.1.8 lib/overcommit/plugins/commit_msg/release_note.rb
overcommit-0.1.7 lib/overcommit/plugins/commit_msg/release_note.rb