Sha256: 925951d3de7983899a5fb5a79a538ffd15c9bb25b17c9d07b08b5de1acdab287

Contents?: true

Size: 831 Bytes

Versions: 9

Compression:

Stored size: 831 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 settings.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

9 entries across 9 versions & 1 rubygems

Version Path
git-lint-8.8.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-8.7.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-8.6.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-8.5.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-8.4.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-8.3.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-8.2.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-8.1.0 lib/git/lint/analyzers/commit_trailer_format_value.rb
git-lint-8.0.0 lib/git/lint/analyzers/commit_trailer_format_value.rb