Class: Ace::Review::Atoms::PrCommentFormatter
- Inherits:
-
Object
- Object
- Ace::Review::Atoms::PrCommentFormatter
- Defined in:
- lib/ace/review/atoms/pr_comment_formatter.rb
Overview
Format PR comments into a structured markdown report Pure transformation - no side effects
Constant Summary collapse
- REVIEW_STATES =
Review state to human-readable status
{ "APPROVED" => "Approved", "CHANGES_REQUESTED" => "Changes Requested", "COMMENTED" => "Commented", "DISMISSED" => "Dismissed", "PENDING" => "Pending" }.freeze
Class Method Summary collapse
-
.format(comments_data) ⇒ String
Format comments data into markdown report.
Class Method Details
.format(comments_data) ⇒ String
Format comments data into markdown report
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ace/review/atoms/pr_comment_formatter.rb', line 25 def self.format(comments_data) return nil unless comments_data && comments_data[:success] pr_number = comments_data[:pr_number] pr_title = comments_data[:pr_title] comments = comments_data[:comments] || [] reviews = comments_data[:reviews] || [] review_threads = comments_data[:review_threads] || [] # Build report sections frontmatter = build_frontmatter(comments_data) summary = build_summary(comments, reviews, review_threads, pr_number, pr_title) inline_section = build_inline_comments_section(review_threads) unresolved_section = build_unresolved_section(comments, reviews) resolved_section = build_resolved_section(reviews) comments_table = build_comments_table(comments, reviews) # Combine sections sections = [frontmatter, summary] sections << inline_section unless inline_section.nil? sections << unresolved_section unless unresolved_section.nil? sections << resolved_section unless resolved_section.nil? sections << comments_table unless comments_table.nil? sections.join("\n") end |