Sha256: 4dc1633e4eb82892e6e7ac0a73170eff21445263dbe3cb65c9442870ca27536c

Contents?: true

Size: 814 Bytes

Versions: 3

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      class CommitBodyBulletDelimiter < Abstract
        def self.defaults
          {
            enabled: true,
            severity: :error,
            includes: %w[\\-]
          }
        end

        def valid?
          commit.body_lines.none? { |line| invalid_line? line }
        end

        def issue
          return {} if valid?

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

        protected

        def load_filter_list
          Kit::FilterList.new settings.fetch :includes
        end

        def invalid_line? line
          line.match?(/\A\s*#{Regexp.union filter_list.to_regexp}(?!\s).+\Z/)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
git-lint-1.1.0 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb
git-lint-1.0.1 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb
git-lint-1.0.0 lib/git/lint/analyzers/commit_body_bullet_delimiter.rb