Sha256: 83421fcced205db1c6ab327f7b8a6d9996164f301ccc3dc03574a9da347627ee

Contents?: true

Size: 926 Bytes

Versions: 12

Compression:

Stored size: 926 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer signer email address format.
      class CommitTrailerSignerEmail < Abstract
        include Import[
          pattern: "trailers.signer",
          parser: "parsers.person",
          sanitizer: "sanitizers.email",
          validator: "validators.email"
        ]

        def valid? = affected_commit_trailers.empty?

        def issue
          return {} if valid?

          {
            hint: %(Email must follow name and use format: "<name@server.domain>".),
            lines: affected_commit_trailers
          }
        end

        protected

        def invalid_line? trailer
          email = sanitizer.call parser.call(trailer.value).email
          trailer.key.match?(pattern) && !validator.call(email)
        end

        private

        attr_reader :parser, :validator
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
git-lint-6.2.1 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-6.2.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-6.1.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-6.0.2 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-6.0.1 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-6.0.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-5.3.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-5.2.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-5.1.2 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-5.1.1 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-5.1.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-5.0.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb