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 previously-reviewed commit recorded on the sticky pull request
comment, provided it 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
sticky comment survives in history, or on any lookup error.
Constant Summary collapse
- MARKER_PREFIX =
StickyCommentBuilder::MARKER_PREFIX
- COMMIT_PATTERN =
/#{Regexp.escape(MARKER_PREFIX)}\s*commit=(\S+)\s*-->/- DISABLED_VALUES =
%w[0 false no off].freeze
- ENABLED_ENV_KEY =
"CLEO_QUALITY_REVIEW_INCREMENTAL"- COMMENTS_PER_PAGE =
100- MAX_COMMENT_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.
31 32 33 34 35 |
# File 'lib/cleo_quality_review/incremental_base_resolver.rb', line 31 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.
41 42 43 44 45 46 47 48 |
# File 'lib/cleo_quality_review/incremental_base_resolver.rb', line 41 def resolve(head: "HEAD") return nil unless incremental_lookup_available? reviewed_commit(head) rescue StandardError => error warn("cleo-quality-review: incremental base lookup failed (#{error.}); reviewing the full diff") nil end |