Sha256: 22178ed6fae710bdb541183b475c134de3c5b2efc5a8504bd2bb562a8b5fe0b4

Contents?: true

Size: 795 Bytes

Versions: 6

Compression:

Stored size: 795 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_hint}.),
            lines: affected_commit_body_lines
          }
        end

        protected

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

        def invalid_line? line
          line.downcase.match? Regexp.new(
            Regexp.union(filter_list.to_regexp).source,
            Regexp::IGNORECASE
          )
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
git-lint-6.2.1 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-6.2.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-6.1.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-6.0.2 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-6.0.1 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-6.0.0 lib/git/lint/analyzers/commit_body_phrase.rb