Sha256: ce8d5143d596505c9c6b40ad450b3a1db86f2943bc5dc96c6d626db1f8e122a4
Contents?: true
Size: 611 Bytes
Versions: 7
Compression:
Stored size: 611 Bytes
Contents
# frozen_string_literal: true class SubjectLengthCheck < CommitCheck def self.type :subject_length end def initialize(message, options = {}) @subject = message[:subject] @max_length = options.fetch(:max, 50) @min_length = options.fetch(:min, 1) end def message if @subject.length > @max_length "Please limit commit subject line to #{@max_length} characters." else "Please write a commit subject line of at least #{@min_length} "\ 'characters.' end end def fail? @subject.length > @max_length || @subject.length < @min_length end end
Version data entries
7 entries across 7 versions & 1 rubygems