Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use table summary for large groups of dependencies #7463

Merged
merged 6 commits into from Jun 27, 2023
Merged

Conversation

bdragon
Copy link
Member

@bdragon bdragon commented Jun 21, 2023

When a pull request is being created that updates five or more dependencies, render the updates as a table for legibility.

When five or more dependencies are being updated in a pull request, render the updates as a table for legibility.
@bdragon bdragon requested a review from a team as a code owner June 21, 2023 15:16
Comment on lines 428 to 445
def table(rows)
[
table_header(rows[0]),
rows[1..].map { |r| table_row(r) },
].join("\n")
end

def table_header(row)
[
table_row(row),
table_row(["---"] * row.count),
].join("\n")
end

def table_row(row)
"| #{row.join(' | ')} |"
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really clean interface. Thanks!

Comment on lines +325 to 329
elsif update_count > 1
" #{dependency_links[0..-2].join(', ')} and #{dependency_links[-1]}."
else
": #{dependency_links.first}."
" #{dependency_links.first}."
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add a test for when there are less than 5 updates to make sure the formatting is correct outside of a table?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be covered by a few existing tests:

Copy link
Contributor

@brrygrdn brrygrdn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@bdragon bdragon merged commit 3e7546c into main Jun 27, 2023
86 checks passed
@bdragon bdragon deleted the bdragon/pr-deps-table branch June 27, 2023 20:56
brettfo pushed a commit to brettfo/dependabot-core that referenced this pull request Oct 11, 2023
Use table summary for large groups of dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants