Sha256: e2fee354aded73b877eba5c204baf3fafc6ac668cfbc12867a3bd1e9652ccbd7

Contents?: true

Size: 774 Bytes

Versions: 2

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer tracker key usage.
      class CommitTrailerTrackerKey < Abstract
        include Dependencies[setting: "trailers.tracker"]

        def valid? = affected_commit_trailers.empty?

        def issue
          return {} if valid?

          {
            hint: "Use format: #{filter_list.to_usage}.",
            lines: affected_commit_trailers
          }
        end

        protected

        def load_filter_list = Kit::FilterList.new setting.name

        def invalid_line? trailer
          trailer.key.then do |key|
            key.match?(setting.pattern) && !key.match?(/\A#{Regexp.union filter_list}\Z/)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git-lint-9.1.0 lib/git/lint/analyzers/commit_trailer_tracker_key.rb
git-lint-9.0.0 lib/git/lint/analyzers/commit_trailer_tracker_key.rb