Sha256: dff333abc6c03660983545a0f265db29566be3c75bf381f2c22ee51140793b95

Contents?: true

Size: 732 Bytes

Versions: 5

Compression:

Stored size: 732 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      class CommitSubjectSuffix < Abstract
        def self.defaults
          {
            enabled: true,
            severity: :error,
            excludes: [
              "\\.",
              "\\?",
              "\\!"
            ]
          }
        end

        def valid?
          return true if filter_list.empty?

          !commit.subject.match?(/#{Regexp.union filter_list.to_regexp}\Z/)
        end

        def issue
          return {} if valid?

          {hint: %(Avoid: #{filter_list.to_hint}.)}
        end

        protected

        def load_filter_list = Kit::FilterList.new(settings.fetch(:excludes))
      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_suffix.rb
git-lint-2.3.3 lib/git/lint/analyzers/commit_subject_suffix.rb
git-lint-2.3.2 lib/git/lint/analyzers/commit_subject_suffix.rb
git-lint-2.3.1 lib/git/lint/analyzers/commit_subject_suffix.rb
git-lint-2.3.0 lib/git/lint/analyzers/commit_subject_suffix.rb