Sha256: f6848bd37886ae02c801c37b509560bca6491ae51cd37fe1b3d7037c9204d49e

Contents?: true

Size: 593 Bytes

Versions: 11

Compression:

Stored size: 593 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
        end

        def issue
          return {} if valid?

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

        private

        def length
          settings.fetch :length
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
git-lint-2.2.1 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-2.2.0 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-2.1.0 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-2.0.0 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-1.4.0 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-1.3.0 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-1.2.0 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-1.1.1 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-1.1.0 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-1.0.1 lib/git/lint/analyzers/commit_subject_length.rb
git-lint-1.0.0 lib/git/lint/analyzers/commit_subject_length.rb