Sha256: f0f0fc8edd8c1d26b6d9db0e9e7bccafe710e3ba7d8e16b5394b29ff866d9e3d

Contents?: true

Size: 940 Bytes

Versions: 5

Compression:

Stored size: 940 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer signer name construction.
      class CommitTrailerSignerName < Abstract
        include Import[
          setting: "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?(setting.pattern) && !validator.call(person.name, minimum:)
          end
        end

        private

        def minimum = configuration.commits_trailer_signer_name_minimum
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-lint-7.5.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-7.3.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-7.2.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-7.1.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-7.0.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb