Sha256: c1df8bdafe8bd0b46c2abdb5214db461f4fe74b1e920d2bf84d8d5423ce54931
Contents?: true
Size: 909 Bytes
Versions: 9
Compression:
Stored size: 909 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 locally_prefixed? return true if filter_list.empty? commit.subject.match?(/\A#{Regexp.union filter_list}/) end def issue return {} if valid? {hint: %(Use: #{filter_list.to_usage "or"}.)} end protected def load_filter_list settings.commits_subject_prefix_includes .map { |prefix| "#{prefix}#{delimiter}" } .then { |list| Kit::FilterList.new list } end def locally_prefixed? = !ci? && commit.directive? def ci? = environment["CI"] == "true" def delimiter = settings.commits_subject_prefix_delimiter end end end end
Version data entries
9 entries across 9 versions & 1 rubygems