Class: CleoQualityReview::IncrementalBaseResolver
- Inherits:
-
Object
- Object
- CleoQualityReview::IncrementalBaseResolver
- Defined in:
- lib/cleo_quality_review/incremental_base_resolver.rb
Overview
Resolves the git base for an incremental review.
On a pull request that cleo-quality-review has already reviewed, this
returns the most recent previously-reviewed commit that is still an
ancestor of the current head, so only changes made since that review are
analysed. It falls back to nil (meaning "review the full diff") outside a
pull request context, when no prior review survives in history, or on any
lookup error.
Constant Summary collapse
- REVIEW_MARKER_PREFIX =
"<!-- cleo-quality-review:"- DISABLED_VALUES =
%w[0 false no off].freeze
- ENABLED_ENV_KEY =
"CLEO_QUALITY_REVIEW_INCREMENTAL"- REVIEWS_PER_PAGE =
100- MAX_REVIEW_PAGES =
20
Instance Method Summary collapse
-
#initialize(command_runner:, env: ENV, client: nil) ⇒ IncrementalBaseResolver
constructor
A new instance of IncrementalBaseResolver.
-
#resolve(head: "HEAD") ⇒ String?
Resolve the incremental base commit.
Constructor Details
#initialize(command_runner:, env: ENV, client: nil) ⇒ IncrementalBaseResolver
Returns a new instance of IncrementalBaseResolver.
29 30 31 32 33 |
# File 'lib/cleo_quality_review/incremental_base_resolver.rb', line 29 def initialize(command_runner:, env: ENV, client: nil) @command_runner = command_runner @env = env @client = client end |
Instance Method Details
#resolve(head: "HEAD") ⇒ String?
Resolve the incremental base commit.
39 40 41 42 43 44 45 46 |
# File 'lib/cleo_quality_review/incremental_base_resolver.rb', line 39 def resolve(head: "HEAD") return nil unless incremental_lookup_available? newest_reviewed_ancestor(head) rescue StandardError => error warn("cleo-quality-review: incremental base lookup failed (#{error.}); reviewing the full diff") nil end |