Sha256: 265ebbe3bd407ff81a508cfa061845c074084ef92dd312afd42537c8818ebc9b

Contents?: true

Size: 595 Bytes

Versions: 6

Compression:

Stored size: 595 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit subject uses standard prefix.
      class CommitSubjectPrefix < Abstract
        def valid?
          return true if commit.prefix?
          return true if filter_list.empty?

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

        def issue
          return {} if valid?

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

        protected

        def load_filter_list = Kit::FilterList.new(settings.includes)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
git-lint-3.3.0 lib/git/lint/analyzers/commit_subject_prefix.rb
git-lint-3.2.0 lib/git/lint/analyzers/commit_subject_prefix.rb
git-lint-3.1.0 lib/git/lint/analyzers/commit_subject_prefix.rb
git-lint-3.0.2 lib/git/lint/analyzers/commit_subject_prefix.rb
git-lint-3.0.1 lib/git/lint/analyzers/commit_subject_prefix.rb
git-lint-3.0.0 lib/git/lint/analyzers/commit_subject_prefix.rb