Sha256: 78660995f0dc40da06c065df717e7b8a1ff840073a6480a4e4501d51b3534ca3

Contents?: true

Size: 751 Bytes

Versions: 22

Compression:

Stored size: 751 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(settings.excludes)

        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

22 entries across 22 versions & 1 rubygems

Version Path
git-lint-5.3.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-5.2.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-5.1.2 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-5.1.1 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-5.1.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-5.0.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-4.6.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-4.5.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-4.4.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-4.3.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-4.2.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-4.1.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-4.0.1 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-4.0.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-3.3.2 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-3.3.1 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-3.3.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-3.2.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-3.1.0 lib/git/lint/analyzers/commit_body_phrase.rb
git-lint-3.0.2 lib/git/lint/analyzers/commit_body_phrase.rb