lib/git/lint/analyzers/commit_body_phrase.rb in git-lint-2.4.0 vs lib/git/lint/analyzers/commit_body_phrase.rb in git-lint-3.0.0
- old
+ new
@@ -1,48 +1,12 @@
# frozen_string_literal: true
module Git
module Lint
module Analyzers
+ # Analyzes use of commit body phrases that are not informative.
class CommitBodyPhrase < Abstract
- # rubocop:disable Metrics/MethodLength
- 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
- # rubocop:enable Metrics/MethodLength
-
def valid? = commit.body_lines.all? { |line| !invalid_line? line }
def issue
return {} if valid?
@@ -52,10 +16,10 @@
}
end
protected
- def load_filter_list = Kit::FilterList.new(settings.fetch(:excludes))
+ def load_filter_list = Kit::FilterList.new(settings.excludes)
def invalid_line? line
line.downcase.match? Regexp.new(
Regexp.union(filter_list.to_regexp).source,
Regexp::IGNORECASE