Skip to content

Conversation

@sundaram123krishnan
Copy link
Contributor

@sundaram123krishnan sundaram123krishnan commented Jan 28, 2026

Fixes #3325

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly improves the readability of the chroot build graphs by switching to a horizontal, sorted bar chart with dynamic height and distro-specific colors. The code is much cleaner and more effective at visualizing the data.

I have one suggestion to make the code more robust. Additionally, for future improvements, you might consider moving the osColors object and getColor function outside of chrootGraph to the module scope. Since they are constants, this would prevent them from being recreated on every function call, leading to better performance and code organization.

if (!name) return osColors['alien'];
var lowerName = name.toLowerCase();
for (var os in osColors) {
if (lowerName.indexOf(os) !== -1) return osColors[os];

Choose a reason for hiding this comment

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

medium

Iterating over an object with for...in can include inherited properties from the prototype chain. To make this loop more robust, it's best practice to check if the property belongs to the object itself using Object.prototype.hasOwnProperty.call().

Suggested change
if (lowerName.indexOf(os) !== -1) return osColors[os];
if (Object.prototype.hasOwnProperty.call(osColors, os) && lowerName.indexOf(os) !== -1) return osColors[os];

@github-actions
Copy link

Pull Request validation

Failed

🔴 Review - Missing review from a member (2 required)

Success

🟢 CI - All checks have passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nicer statistics

1 participant