Sha256: ee3442fab0bc2f4ba7485ce65daae99af045139a2a62be26f5070de7762d9f2b

Contents?: true

Size: 699 Bytes

Versions: 14

Compression:

Stored size: 699 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit body for repeated words.
      class CommitBodyWordRepeat < Abstract
        include Import[validator: "validators.repeated_word"]

        def valid? = commit.body_lines.all? { |line| !invalid_line? line }

        def issue
          return {} if valid?

          {
            hint: "Avoid repeating these words: #{validator.call commit.body}.",
            lines: affected_commit_body_lines
          }
        end

        protected

        def invalid_line? line
          return false if line.start_with? "#"

          !validator.call(line).empty?
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
git-lint-8.8.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-8.7.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-8.6.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-8.5.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-8.4.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-8.3.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-8.2.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-8.1.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-8.0.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-7.5.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-7.3.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-7.2.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-7.1.0 lib/git/lint/analyzers/commit_body_word_repeat.rb
git-lint-7.0.0 lib/git/lint/analyzers/commit_body_word_repeat.rb