Sha256: 3f32386c8a754f18726a1decfee245e65256af91aec6115ab79223329ab66bea

Contents?: true

Size: 733 Bytes

Versions: 5

Compression:

Stored size: 733 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
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-lint-7.5.0 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb
git-lint-7.3.0 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb
git-lint-7.2.0 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb
git-lint-7.1.0 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb
git-lint-7.0.0 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb