Class: CleoQualityReview::StickyCommentBuilder
- Inherits:
-
Object
- Object
- CleoQualityReview::StickyCommentBuilder
- Defined in:
- lib/cleo_quality_review/sticky_comment_builder.rb
Overview
Builds the marker and body for the sticky pull request comment from rendered pr_review JSON
Constant Summary collapse
- MARKER_PREFIX =
"<!-- cleo-quality-review:"- MAX_BODY_LENGTH =
3_500- CLEAN_MESSAGE =
"Cleo quality review found no high-confidence issues worth flagging on this change."
Instance Method Summary collapse
-
#comment_body(commit_sha:) ⇒ String
Full comment body, including the hidden marker.
-
#empty? ⇒ Boolean
Whether the rendered review has anything worth publishing.
-
#initialize(rendered_review:) ⇒ StickyCommentBuilder
constructor
A new instance of StickyCommentBuilder.
Constructor Details
#initialize(rendered_review:) ⇒ StickyCommentBuilder
Returns a new instance of StickyCommentBuilder.
18 19 20 |
# File 'lib/cleo_quality_review/sticky_comment_builder.rb', line 18 def initialize(rendered_review:) @rendered_review = rendered_review end |
Instance Method Details
#comment_body(commit_sha:) ⇒ String
Returns full comment body, including the hidden marker.
25 26 27 |
# File 'lib/cleo_quality_review/sticky_comment_builder.rb', line 25 def comment_body(commit_sha:) [marker(commit_sha), truncate(display_body)].join("\n\n") end |
#empty? ⇒ Boolean
Returns whether the rendered review has anything worth publishing.
31 32 33 |
# File 'lib/cleo_quality_review/sticky_comment_builder.rb', line 31 def empty? body_text.empty? end |