Sha256: b1ec038b1272522a4326002e62dab4f942f06f1d5d39e8ad7742d9aee113a375

Contents?: true

Size: 944 Bytes

Versions: 12

Compression:

Stored size: 944 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer collaborator email address format.
      class CommitTrailerCollaboratorEmail < Abstract
        include Import[
          pattern: "trailers.collaborator",
          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_collaborator_email.rb
git-lint-6.2.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-6.1.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-6.0.2 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-6.0.1 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-6.0.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-5.3.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-5.2.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-5.1.2 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-5.1.1 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-5.1.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-5.0.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb