Sha256: d9a29bc308082802cb4101f585da207625e06f86016edc7a58c48c17c0ede3bf

Contents?: true

Size: 670 Bytes

Versions: 11

Compression:

Stored size: 670 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 = configuration.commits_body_line_length_maximum
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
git-lint-7.5.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-7.3.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-7.2.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-7.1.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-7.0.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-6.2.1 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-6.2.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-6.1.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-6.0.2 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-6.0.1 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-6.0.0 lib/git/lint/analyzers/commit_body_line_length.rb