Sha256: 60b625f5926dfd835e6d2a747fc0276a172ebc232b4f04748177804f5f75d0cc

Contents?: true

Size: 896 Bytes

Versions: 14

Compression:

Stored size: 896 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer collaborator email address format.
      class CommitTrailerCollaboratorEmail < Abstract
        include Import[
          setting: "trailers.collaborator",
          parser: "parsers.person",
          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 = parser.call(trailer.value).email
          trailer.key.match?(setting.pattern) && !validator.call(email)
        end

        private

        attr_reader :parser, :validator
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
git-lint-8.8.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-8.7.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-8.6.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-8.5.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-8.4.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-8.3.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-8.2.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-8.1.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-8.0.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-7.5.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-7.3.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-7.2.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-7.1.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb
git-lint-7.0.0 lib/git/lint/analyzers/commit_trailer_collaborator_email.rb