Sha256: 1cfd5e2c0d85dfdd3fd591780a87f65a924db683e4e2c100c79af6697038a1ef
Contents?: true
Size: 980 Bytes
Versions: 5
Compression:
Stored size: 980 Bytes
Contents
# frozen_string_literal: true module Git module Lint module Analyzers class CommitBodyIssueTrackerLink < Abstract def self.defaults { enabled: true, severity: :error, excludes: [ "(f|F)ix(es|ed)?\\s\\#\\d+", "(c|C)lose(s|d)?\\s\\#\\d+", "(r|R)esolve(s|d)?\\s\\#\\d+", "github\\.com\\/.+\\/issues\\/\\d+" ] } end def valid? = commit.body_lines.none? { |line| invalid_line? line } def issue return {} if valid? { hint: "Explain issue instead of using link. Avoid: #{filter_list.to_hint}.", lines: affected_commit_body_lines } end protected def load_filter_list = Kit::FilterList.new(settings.fetch(:excludes)) def invalid_line?(line) = line.match?(/.*#{Regexp.union filter_list.to_regexp}.*/) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems