class Git::Lint::Analyzers::CommitTrailerCollaboratorKey
Public Class Methods
defaults()
click to toggle source
# File lib/git/lint/analyzers/commit_trailer_collaborator_key.rb, line 7 def self.defaults { enabled: true, severity: :error, includes: ["Co-Authored-By"] } end
new(commit:, settings: self.class.defaults, parser: Parsers::Trailers::Collaborator)
click to toggle source
Calls superclass method
Git::Lint::Analyzers::Abstract::new
# File lib/git/lint/analyzers/commit_trailer_collaborator_key.rb, line 15 def initialize commit:, settings: self.class.defaults, parser: Parsers::Trailers::Collaborator super commit: commit, settings: settings @parser = parser end
Public Instance Methods
invalid_line?(line)
click to toggle source
# File lib/git/lint/analyzers/commit_trailer_collaborator_key.rb, line 37 def invalid_line? line collaborator = parser.new line key = collaborator.key collaborator.match? && !key.empty? && !key.match?( /\A#{Regexp.union filter_list.to_regexp}\Z/ ) end
issue()
click to toggle source
# File lib/git/lint/analyzers/commit_trailer_collaborator_key.rb, line 24 def issue return {} if valid? { hint: "Use format: #{filter_list.to_hint}.", lines: affected_commit_trailers } end
load_filter_list(= Kit::FilterList.new(settings.fetch(:includes)))
click to toggle source
# File lib/git/lint/analyzers/commit_trailer_collaborator_key.rb, line 35 def load_filter_list = Kit::FilterList.new(settings.fetch(:includes)) def invalid_line? line collaborator = parser.new line key = collaborator.key collaborator.match? && !key.empty? && !key.match?( /\A#{Regexp.union filter_list.to_regexp}\Z/ ) end private attr_reader :parser end
valid?(= affected_commit_trailers.empty?)
click to toggle source
# File lib/git/lint/analyzers/commit_trailer_collaborator_key.rb, line 22 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.fetch(:includes)) def invalid_line? line collaborator = parser.new line key = collaborator.key collaborator.match? && !key.empty? && !key.match?( /\A#{Regexp.union filter_list.to_regexp}\Z/ ) end private attr_reader :parser end end