Sha256: a490a86890a57fa47ea4cd05321156370c898329952e36093ed001f723af278b

Contents?: true

Size: 728 Bytes

Versions: 11

Compression:

Stored size: 728 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      class CommitBodyPresence < Abstract
        using Refinements::Strings

        def self.defaults
          {
            enabled: true,
            severity: :warn,
            minimum: 1
          }
        end

        def valid?
          return true if commit.fixup?

          valid_lines = commit.body_lines.reject { |line| line.match?(/^\s*$/) }
          valid_lines.size >= minimum
        end

        def minimum
          settings.fetch :minimum
        end

        def issue
          return {} if valid?

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
git-lint-2.2.1 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-2.2.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-2.1.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-2.0.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-1.4.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-1.3.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-1.2.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-1.1.1 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-1.1.0 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-1.0.1 lib/git/lint/analyzers/commit_body_presence.rb
git-lint-1.0.0 lib/git/lint/analyzers/commit_body_presence.rb