Class: RosettAi::Authorship::ReviewValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/authorship/review_validator.rb

Overview

Validates that Human-Reviewed-By differs from the commit author.

Self-review (where the submitter is also the reviewer) does not satisfy the review requirement. At advisory level this produces a warning; at strict level it produces an error.

Instance Method Summary collapse

Instance Method Details

#validate(author:, reviewer:) ⇒ Hash

Result of a review validation check.

Returns:

  • (Hash)

    with +:valid+ (Boolean) and +:message+ (String, nil)



17
18
19
20
21
22
# File 'lib/rosett_ai/authorship/review_validator.rb', line 17

def validate(author:, reviewer:)
  return success if author.nil? || reviewer.nil?
  return success unless normalize(author) == normalize(reviewer)

  failure('Human-Reviewed-By must differ from the commit author (self-review detected)')
end