Sha256: 8e02816f6a8d38fcee1ba5ea84fea0b3579baef536584a0d0f654e8ed1b17e86

Contents?: true

Size: 745 Bytes

Versions: 9

Compression:

Stored size: 745 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes use of commit body phrases that are not informative.
      class CommitBodyPhrase < Abstract
        def valid? = commit.body_lines.all? { |line| !invalid_line? line }

        def issue
          return {} if valid?

          {
            hint: %(Avoid: #{filter_list.to_usage}.),
            lines: affected_commit_body_lines
          }
        end

        protected

        def load_filter_list
          Kit::FilterList.new settings.commits_body_phrase_excludes
        end

        def invalid_line? line
          line.downcase.match? Regexp.new(Regexp.union(filter_list).source, Regexp::IGNORECASE)
        end
      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_body_phrase.rb
git-lint-8.7.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-8.6.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-8.5.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-8.4.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-8.3.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-8.2.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-8.1.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-8.0.0 lib/git/lint/analyzers/commit_body_phrase.rb