Sha256: dfb5e70a2e84a6b914d91ea9c7d540854daf3fbf7002f023a07ac6187c1fc40b

Contents?: true

Size: 935 Bytes

Versions: 9

Compression:

Stored size: 935 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 = settings.commits_trailer_signer_name_minimum
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
git-lint-8.8.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-8.7.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-8.6.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-8.5.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-8.4.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-8.3.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-8.2.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-8.1.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb
git-lint-8.0.0 lib/git/lint/analyzers/commit_trailer_signer_name.rb