Sha256: f50b151423d707772487e467bc43e07574bab70687d1415af059945dac4ad71e

Contents?: true

Size: 800 Bytes

Versions: 11

Compression:

Stored size: 800 Bytes

Contents

# frozen_string_literal: true

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

        def valid?
          affected_commit_body_lines.size != 1
        end

        def issue
          return {} if valid?

          {
            hint: "Use paragraph instead of single 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#{Regexp.union filter_list.to_regexp}\s+/)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
git-lint-2.2.1 lib/git/lint/analyzers/commit_body_single_bullet.rb
git-lint-2.2.0 lib/git/lint/analyzers/commit_body_single_bullet.rb
git-lint-2.1.0 lib/git/lint/analyzers/commit_body_single_bullet.rb
git-lint-2.0.0 lib/git/lint/analyzers/commit_body_single_bullet.rb
git-lint-1.4.0 lib/git/lint/analyzers/commit_body_single_bullet.rb
git-lint-1.3.0 lib/git/lint/analyzers/commit_body_single_bullet.rb
git-lint-1.2.0 lib/git/lint/analyzers/commit_body_single_bullet.rb
git-lint-1.1.1 lib/git/lint/analyzers/commit_body_single_bullet.rb
git-lint-1.1.0 lib/git/lint/analyzers/commit_body_single_bullet.rb
git-lint-1.0.1 lib/git/lint/analyzers/commit_body_single_bullet.rb
git-lint-1.0.0 lib/git/lint/analyzers/commit_body_single_bullet.rb