class Git::Lint::Analyzers::CommitBodyPhrase
Public Class Methods
defaults()
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/git/lint/analyzers/commit_body_phrase.rb, line 8 def self.defaults { enabled: true, severity: :error, excludes: [ "absolutely", "actually", "all intents and purposes", "along the lines", "at this moment in time", "basically", "each and every one", "everyone knows", "fact of the matter", "furthermore", "however", "in due course", "in the end", "last but not least", "matter of fact", "obviously", "of course", "really", "simply", "things being equal", "would like to", /\beasy\b/, /\bjust\b/, /\bquite\b/, /as\sfar\sas\s.+\sconcerned/, /of\sthe\s(fact|opinion)\sthat/ ] } end
Public Instance Methods
invalid_line?(line)
click to toggle source
# File lib/git/lint/analyzers/commit_body_phrase.rb, line 59 def invalid_line? line line.downcase.match? Regexp.new( Regexp.union(filter_list.to_regexp).source, Regexp::IGNORECASE ) end
issue()
click to toggle source
# File lib/git/lint/analyzers/commit_body_phrase.rb, line 46 def issue return {} if valid? { hint: %(Avoid: #{filter_list.to_hint}.), lines: affected_commit_body_lines } end
load_filter_list(= Kit::FilterList.new(settings.fetch(:excludes)))
click to toggle source
# File lib/git/lint/analyzers/commit_body_phrase.rb, line 57 def load_filter_list = Kit::FilterList.new(settings.fetch(:excludes)) def invalid_line? line line.downcase.match? Regexp.new( Regexp.union(filter_list.to_regexp).source, Regexp::IGNORECASE ) end end
valid?(= commit.body_lines.all? { |line| !invalid_line? line })
click to toggle source
rubocop:enable Metrics/MethodLength
# File lib/git/lint/analyzers/commit_body_phrase.rb, line 44 def valid? = commit.body_lines.all? { |line| !invalid_line? line } def issue return {} if valid? { hint: %(Avoid: #{filter_list.to_hint}.), lines: affected_commit_body_lines } end protected def load_filter_list = Kit::FilterList.new(settings.fetch(:excludes)) def invalid_line? line line.downcase.match? Regexp.new( Regexp.union(filter_list.to_regexp).source, Regexp::IGNORECASE ) end end end