Sha256: 9192df918c1b7e82a13dd074f3d06cb4e0b60c435c4016afb39f779985f3ec8a

Contents?: true

Size: 836 Bytes

Versions: 5

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit trailer format value.
      class CommitTrailerFormatValue < Abstract
        include Import[setting: "trailers.format"]

        def valid? = affected_commit_trailers.empty?

        def issue
          return {} if valid?

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

        protected

        def load_filter_list
          Kit::FilterList.new configuration.commits_trailer_format_value_includes
        end

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-lint-7.5.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-7.3.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-7.2.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-7.1.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-7.0.0 lib/git/lint/analyzers/commit_trailer_format_value.rb