Sha256: b775b776d36ddd296ad77c0d32983a2685f43ba54493f6f78de51f8ab6ec04f3

Contents?: true

Size: 568 Bytes

Versions: 26

Compression:

Stored size: 568 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?
          raw = commit.raw
          subject, body = raw.split "\n", 2

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

          raw.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

26 entries across 26 versions & 1 rubygems

Version Path
git-lint-8.8.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-8.7.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-8.6.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-8.5.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-8.4.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-8.3.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-8.2.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-8.1.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-8.0.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-7.5.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-7.3.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-7.2.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-7.1.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-7.0.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-6.2.1 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-6.2.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-6.1.0 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-6.0.2 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-6.0.1 lib/git/lint/analyzers/commit_body_leading_line.rb
git-lint-6.0.0 lib/git/lint/analyzers/commit_body_leading_line.rb