Sha256: 8401e1b9e3153af4bdd370339938a8d5773f504a32078da32ea4b5cca6c83d34

Contents?: true

Size: 878 Bytes

Versions: 14

Compression:

Stored size: 878 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer signer email address format.
      class CommitTrailerSignerEmail < Abstract
        include Import[
          setting: "trailers.signer",
          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_signer_email.rb
git-lint-8.7.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-8.6.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-8.5.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-8.4.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-8.3.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-8.2.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-8.1.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-8.0.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-7.5.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-7.3.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-7.2.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-7.1.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb
git-lint-7.0.0 lib/git/lint/analyzers/commit_trailer_signer_email.rb