Sha256: b78d9fcd798ef34ca154073f00f497da105e651ab7b981264be0809d924bb8e0

Contents?: true

Size: 726 Bytes

Versions: 10

Compression:

Stored size: 726 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Analyzers
      # Analyzes body tracker shorthand usage.
      class CommitBodyTrackerShorthand < Abstract
        def valid? = commit.body_lines.none? { |line| invalid_line? line }

        def issue
          return {} if valid?

          {
            hint: "Explain issue instead of using shorthand. Avoid: #{filter_list.to_usage}.",
            lines: affected_commit_body_lines
          }
        end

        protected

        def load_filter_list
          Kit::FilterList.new settings.commits_body_tracker_shorthand_excludes
        end

        def invalid_line?(line) = line.match?(/.*#{Regexp.union filter_list}.*/)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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