Sha256: 6f58b0b3ac61a92c109cccf87d02b80f14335b5a406948f27a9a632cd358e3cd

Contents?: true

Size: 554 Bytes

Versions: 5

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      class CommitSubjectLength < Abstract
        def self.defaults
          {
            enabled: true,
            severity: :error,
            length: 72
          }
        end

        def valid? = commit.subject.sub(/(fixup!|squash!)\s{1}/, "").size <= length

        def issue
          return {} if valid?

          {hint: "Use #{length} characters or less."}
        end

        private

        def length = settings.fetch(:length)
      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_subject_length.rb
git-lint-2.3.3 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-2.3.2 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-2.3.1 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-2.3.0 lib/git/lint/analyzers/commit_subject_length.rb