Sha256: a58aa70da16e2cf3b823faf4a7f90619d2cf4baf2a35ffe22bb1a5fe12180b41

Contents?: true

Size: 812 Bytes

Versions: 5

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      class CommitAuthorName < Abstract
        def self.defaults
          {
            enabled: true,
            severity: :error,
            minimum: 2
          }
        end

        def initialize commit:, settings: self.class.defaults, validator: Validators::Name
          super commit: commit, settings: settings
          @validator = validator
        end

        def valid? = validator.new(commit.author_name, minimum: minimum).valid?

        def issue
          return {} if valid?

          {hint: "Author name must consist of #{minimum} parts (minimum)."}
        end

        private

        attr_reader :validator

        def minimum
          settings.fetch __method__
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-lint-2.4.0 lib/git/lint/analyzers/commit_author_name.rb
git-lint-2.3.3 lib/git/lint/analyzers/commit_author_name.rb
git-lint-2.3.2 lib/git/lint/analyzers/commit_author_name.rb
git-lint-2.3.1 lib/git/lint/analyzers/commit_author_name.rb
git-lint-2.3.0 lib/git/lint/analyzers/commit_author_name.rb