Sha256: 6313674379e3832c152de12d677bde27a47ee6a654fc5d8aeeebfbf2b18f7d83

Contents?: true

Size: 828 Bytes

Versions: 6

Compression:

Stored size: 828 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer issue value.
      class CommitTrailerIssueValue < 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 configuration.commits_trailer_issue_value_includes
        end

        def invalid_line? trailer
          trailer.key.match?(pattern) && !trailer.value.match?(value_pattern)
        end

        def value_pattern = /\A#{Regexp.union filter_list.to_regexp}\Z/
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
git-lint-6.2.1 lib/git/lint/analyzers/commit_trailer_issue_value.rb
git-lint-6.2.0 lib/git/lint/analyzers/commit_trailer_issue_value.rb
git-lint-6.1.0 lib/git/lint/analyzers/commit_trailer_issue_value.rb
git-lint-6.0.2 lib/git/lint/analyzers/commit_trailer_issue_value.rb
git-lint-6.0.1 lib/git/lint/analyzers/commit_trailer_issue_value.rb
git-lint-6.0.0 lib/git/lint/analyzers/commit_trailer_issue_value.rb