Sha256: 636f9b42183bd14f8a255a7eef7de2528d4ad83f0754dff257a45dff7ec94aa3

Contents?: true

Size: 631 Bytes

Versions: 9

Compression:

Stored size: 631 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      class CommitBodyLeadingLine < Abstract
        def self.defaults
          {
            enabled: true,
            severity: :error
          }
        end

        def valid?
          message = commit.message
          subject, body = message.split "\n", 2

          return true if !String(subject).empty? && String(body).strip.empty?

          message.match?(/\A.+(\n\n|\#).+/m)
        end

        def issue
          return {} if valid?

          {hint: "Use blank line between subject and body."}
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
git-lint-2.4.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-2.3.3 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-2.3.2 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-2.3.1 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-2.3.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-2.2.1 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-2.2.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-2.1.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-2.0.0 lib/git/lint/analyzers/commit_body_leading_line.rb