Sha256: 3ae00b5fc18dfb961cbadfe3533f697ca12a2ec523e11510d1f6f803d77ccb42

Contents?: true

Size: 834 Bytes

Versions: 12

Compression:

Stored size: 834 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer collaborator name capitalization.
      class CommitTrailerCollaboratorCapitalization < Abstract
        include Import[
          pattern: "trailers.collaborator",
          parser: "parsers.person",
          validator: "validators.capitalization"
        ]

        def valid? = affected_commit_trailers.empty?

        def issue
          return {} if valid?

          {
            hint: "Name must be capitalized.",
            lines: affected_commit_trailers
          }
        end

        protected

        def invalid_line? trailer
          parser.call(trailer.value).then do |person|
            trailer.key.match?(pattern) && !validator.call(person.name)
          end
        end
      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_capitalization.rb
git-lint-6.2.0 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb
git-lint-6.1.0 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb
git-lint-6.0.2 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb
git-lint-6.0.1 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb
git-lint-6.0.0 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb
git-lint-5.3.0 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb
git-lint-5.2.0 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb
git-lint-5.1.2 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb
git-lint-5.1.1 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb
git-lint-5.1.0 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb
git-lint-5.0.0 lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb