Sha256: 1c4f2751035d2dfbb69a6bfdcc423a9fc7284a9a691f1e2f5786c8432892567e

Contents?: true

Size: 608 Bytes

Versions: 10

Compression:

Stored size: 608 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes presence of commit body.
      class CommitBodyPresence < Abstract
        using Refinements::String

        def valid?
          return true if commit.fixup?

          valid_lines = commit.body_lines.grep_v(/^\s*$/)
          valid_lines.size >= minimum
        end

        def minimum = settings.commits_body_presence_minimum

        def issue
          return {} if valid?

          {hint: %(Use minimum of #{"#{minimum} line".pluralize "s", minimum} (non-empty).)}
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
git-lint-9.0.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-8.8.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-8.7.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-8.6.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-8.5.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-8.4.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-8.3.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-8.2.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-8.1.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-8.0.0 lib/git/lint/analyzers/commit_body_presence.rb