Sha256: 094487a77e60eb4ad8727889f831a63548fd4e881df7058f0f26b2ebd268d1c0

Contents?: true

Size: 623 Bytes

Versions: 6

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true

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

        def valid?
          return true if commit.fixup?

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

        def minimum = configuration.commits_body_presence_minimum

        def issue
          return {} if valid?

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
git-lint-6.2.1 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-6.2.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-6.1.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-6.0.2 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-6.0.1 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-6.0.0 lib/git/lint/analyzers/commit_body_presence.rb