Class: Git::Lint::Analyzers::CommitTrailerOrder
- Defined in:
- lib/git/lint/analyzers/commit_trailer_order.rb
Overview
Analyzes commit trailer order value.
Constant Summary
Constants inherited from Abstract
Abstract::BODY_OFFSET, Abstract::LEVELS
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
-
#initialize ⇒ CommitTrailerOrder
constructor
A new instance of CommitTrailerOrder.
- #issue ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from Abstract
build_issue_line, #error?, id, #invalid?, label, #severity, #warning?
Constructor Details
#initialize ⇒ CommitTrailerOrder
Returns a new instance of CommitTrailerOrder.
8 9 10 11 12 |
# File 'lib/git/lint/analyzers/commit_trailer_order.rb', line 8 def initialize(...) super @original_order = commit.trailers.map(&:key) @sorted_order = original_order.sort end |
Instance Method Details
#issue ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/git/lint/analyzers/commit_trailer_order.rb', line 16 def issue return {} if valid? { hint: "Ensure keys are alphabetically sorted.", lines: affected_commit_trailers } end |
#valid? ⇒ Boolean
14 |
# File 'lib/git/lint/analyzers/commit_trailer_order.rb', line 14 def valid? = original_order == sorted_order |