Sha256: 18c7febca48f8bc575aa2c6e6bc3ff0384bded9d0285552d8898fe9a92e4f658

Contents?: true

Size: 751 Bytes

Versions: 11

Compression:

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

Version data entries

11 entries across 11 versions & 1 rubygems

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