Sha256: 293fca3ccef722de8c0646616d91032c6fc2c110f59e6833bfbee5b908198406

Contents?: true

Size: 411 Bytes

Versions: 3

Compression:

Stored size: 411 Bytes

Contents

module Danger
  module SemanticCommit
    class LengthValidator
      def initialize(length)
        @length = length || default_length
      end

      def valid?(commit)
        commit.fetch(:subject).length < length
      end

      def message(_commit)
        "Commit subject is too long"
      end

      private

      attr_reader :length

      def default_length
        70
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danger-semantic-commit-0.3.1 lib/semantic_commit/length_validator.rb
danger-semantic-commit-0.3.0 lib/semantic_commit/length_validator.rb
danger-semantic-commit-0.2.0 lib/semantic_commit/length_validator.rb