Sha256: ae9144224cd467e3e60095232790cf360b4e02c42fd9731f10f4159b17de9bfe

Contents?: true

Size: 744 Bytes

Versions: 6

Compression:

Stored size: 744 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit body delimiter usage.
      class CommitBodyBulletDelimiter < Abstract
        def valid? = commit.body_lines.none? { |line| invalid_line? line }

        def issue
          return {} if valid?

          {
            hint: "Use space after bullet.",
            lines: affected_commit_body_lines
          }
        end

        protected

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

        def invalid_line?(line) = line.match?(/\A\s*#{pattern}(?!(#{pattern}|\s)).+\Z/)

        def pattern = Regexp.union(filter_list.to_regexp)
      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_bullet_delimiter.rb
git-lint-6.2.0 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb
git-lint-6.1.0 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb
git-lint-6.0.2 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb
git-lint-6.0.1 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb
git-lint-6.0.0 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb