Sha256: de99d970c60547d65d7ec1708e552069cdc9c96c3567dd26cd513e8296822132

Contents?: true

Size: 665 Bytes

Versions: 9

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes commit body line length to prevent unnecessary horizontal scrolling.
      class CommitBodyLineLength < Abstract
        def valid? = commit.body_lines.all? { |line| !invalid_line? line }

        def issue
          return {} if valid?

          {
            hint: "Use #{maximum} characters or less per line.",
            lines: affected_commit_body_lines
          }
        end

        protected

        def invalid_line?(line) = line.length > maximum

        private

        def maximum = settings.commits_body_line_length_maximum
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
git-lint-8.8.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-8.7.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-8.6.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-8.5.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-8.4.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-8.3.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-8.2.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-8.1.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-8.0.0 lib/git/lint/analyzers/commit_body_line_length.rb