Sha256: 3e3d26da3ca0ea94712731a73aa7755699fec35135ac168024e9f5c64fe8c2b3

Contents?: true

Size: 584 Bytes

Versions: 16

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes leading line between commit subject and start of body.
      class CommitBodyLeadingLine < Abstract
        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

16 entries across 16 versions & 1 rubygems

Version Path
git-lint-4.6.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-4.5.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-4.4.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-4.3.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-4.2.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-4.1.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-4.0.1 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-4.0.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-3.3.2 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-3.3.1 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-3.3.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-3.2.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-3.1.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-3.0.2 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-3.0.1 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-3.0.0 lib/git/lint/analyzers/commit_body_leading_line.rb