Sha256: e1871ba32f0cf5097c7ec317bffdbe72b9c377f1c6f4803b4dfbc774b877af7f

Contents?: true

Size: 640 Bytes

Versions: 22

Compression:

Stored size: 640 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.maximum
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
git-lint-5.3.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-5.2.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-5.1.2 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-5.1.1 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-5.1.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-5.0.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-4.6.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-4.5.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-4.4.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-4.3.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-4.2.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-4.1.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-4.0.1 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-4.0.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-3.3.2 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-3.3.1 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-3.3.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-3.2.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-3.1.0 lib/git/lint/analyzers/commit_body_line_length.rb
git-lint-3.0.2 lib/git/lint/analyzers/commit_body_line_length.rb