Sha256: 92c66a72b9b4b9a64eb4a65a94bc4f8af89a6011da918e6dd811902ca975fde6

Contents?: true

Size: 899 Bytes

Versions: 6

Compression:

Stored size: 899 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer signer name construction.
      class CommitTrailerSignerName < Abstract
        include Import[
          pattern: "trailers.signer",
          parser: "parsers.person",
          validator: "validators.name"
        ]

        def valid? = affected_commit_trailers.empty?

        def issue
          return {} if valid?

          {
            hint: "Name must follow key and consist of #{minimum} parts (minimum).",
            lines: affected_commit_trailers
          }
        end

        protected

        def invalid_line? trailer
          parser.call(trailer.value).then do |person|
            trailer.key.match?(pattern) && !validator.call(person.name, minimum:)
          end
        end

        private

        def minimum = settings.minimum
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
git-lint-5.3.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-5.2.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-5.1.2 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-5.1.1 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-5.1.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-5.0.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb