Class: CleoQualityReview::GitHubReviewBuilder::InlineComment
- Inherits:
-
Struct
- Object
- Struct
- CleoQualityReview::GitHubReviewBuilder::InlineComment
- Defined in:
- lib/cleo_quality_review/github_review_builder.rb
Overview
Normalized rendered comment that can be mapped onto a PR diff line
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#line ⇒ Object
Returns the value of attribute line.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #commentable_on?(diff_map) ⇒ Boolean
- #to_review_payload(diff_map:, truncator:) ⇒ Object
- #valid? ⇒ Boolean
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
17 18 19 |
# File 'lib/cleo_quality_review/github_review_builder.rb', line 17 def body @body end |
#line ⇒ Object
Returns the value of attribute line
17 18 19 |
# File 'lib/cleo_quality_review/github_review_builder.rb', line 17 def line @line end |
#path ⇒ Object
Returns the value of attribute path
17 18 19 |
# File 'lib/cleo_quality_review/github_review_builder.rb', line 17 def path @path end |
Instance Method Details
#commentable_on?(diff_map) ⇒ Boolean
22 23 24 |
# File 'lib/cleo_quality_review/github_review_builder.rb', line 22 def commentable_on?(diff_map) valid? && diff_map.commentable?(path, line) end |
#to_review_payload(diff_map:, truncator:) ⇒ Object
26 27 28 29 30 |
# File 'lib/cleo_quality_review/github_review_builder.rb', line 26 def to_review_payload(diff_map:, truncator:) return unless commentable_on?(diff_map) { path: path, line: line, side: "RIGHT", body: truncator.call(body) } end |
#valid? ⇒ Boolean
18 19 20 |
# File 'lib/cleo_quality_review/github_review_builder.rb', line 18 def valid? path != "" && line.positive? && body != "" end |