Sha256: 98c724f08c2097bb39b124d93692f4b9fa6e44a8645bd0b8cf05975da5812830

Contents?: true

Size: 596 Bytes

Versions: 22

Compression:

Stored size: 596 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 = settings.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

22 entries across 22 versions & 1 rubygems

Version Path
git-lint-5.3.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-5.2.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-5.1.2 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-5.1.1 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-5.1.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-5.0.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-4.6.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-4.5.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-4.4.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-4.3.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-4.2.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-4.1.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-4.0.1 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-4.0.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-3.3.2 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-3.3.1 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-3.3.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-3.2.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-3.1.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-3.0.2 lib/git/lint/analyzers/commit_body_presence.rb