Sha256: 72a40134aa60ae098d74ac156c43fe2706b140825b741e067ee9dc3214c7af3f

Contents?: true

Size: 769 Bytes

Versions: 6

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer issue key usage.
      class CommitTrailerIssueKey < Abstract
        include Import[pattern: "trailers.issue"]

        def valid? = affected_commit_trailers.empty?

        def issue
          return {} if valid?

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

        protected

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
git-lint-5.3.0 lib/git/lint/analyzers/commit_trailer_issue_key.rb
git-lint-5.2.0 lib/git/lint/analyzers/commit_trailer_issue_key.rb
git-lint-5.1.2 lib/git/lint/analyzers/commit_trailer_issue_key.rb
git-lint-5.1.1 lib/git/lint/analyzers/commit_trailer_issue_key.rb
git-lint-5.1.0 lib/git/lint/analyzers/commit_trailer_issue_key.rb
git-lint-5.0.0 lib/git/lint/analyzers/commit_trailer_issue_key.rb