Skip to content

Conversation

rishabhtc
Copy link
Collaborator

No description provided.

return false
}

const memberCount = parseInt(reviewer.memberReviewerCount) || 1
Copy link

Choose a reason for hiding this comment

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

The parseInt function should specify a radix to avoid unexpected behavior. Consider using parseInt(reviewer.memberReviewerCount, 10).

<span>
{(() => {
// In read-only mode, try to get the specific scorecard first
if (this.props.readOnly) {
Copy link

Choose a reason for hiding this comment

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

The condition this.props.readOnly is already checked before this block, so it might be redundant to check it again here. Consider removing the redundant check.

{(() => {
// In read-only mode, try to get the specific scorecard first
if (this.props.readOnly) {
const { metadata = {} } = this.props
Copy link

Choose a reason for hiding this comment

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

Consider destructuring metadata and scorecardById directly from this.props for cleaner code.

defaultReviewers: PropTypes.array,
workflows: PropTypes.array
workflows: PropTypes.array,
scorecardById: PropTypes.object
Copy link

Choose a reason for hiding this comment

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

Consider adding a default value for scorecardById in metadata to prevent potential undefined errors.

const { metadata = {} } = this.props
const specificScorecard = metadata.scorecardById
if (specificScorecard && specificScorecard.id === reviewer.scorecardId) {
return `${specificScorecard.name || 'Unknown'} - ${specificScorecard.type || 'Unknown'} (${specificScorecard.challengeTrack || 'Unknown'}) v${specificScorecard.version || 'Unknown'}`
Copy link

Choose a reason for hiding this comment

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

Consider handling the case where specificScorecard.version is undefined or null separately, as using 'Unknown' for a version number might not be appropriate.

// Fallback to searching in the general scorecards array
const scorecard = scorecards.find(s => s.id === reviewer.scorecardId)
return scorecard ? `${scorecard.name} - ${scorecard.type} (${scorecard.challengeTrack}) v${scorecard.version}` : 'Not selected'
return scorecard ? `${scorecard.name || 'Unknown'} - ${scorecard.type || 'Unknown'} (${scorecard.challengeTrack || 'Unknown'}) v${scorecard.version || 'Unknown'}` : 'Not selected'
Copy link

Choose a reason for hiding this comment

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

Consider handling the case where scorecard.version is undefined or null separately, as using 'Unknown' for a version number might not be appropriate.

{scorecards.map(scorecard => (
<option key={scorecard.id} value={scorecard.id}>
{scorecard.name} - {scorecard.type} ({scorecard.challengeTrack}) v{scorecard.version}
{scorecard.name || 'Unknown'} - {scorecard.type || 'Unknown'} ({scorecard.challengeTrack || 'Unknown'}) v{scorecard.version || 'Unknown'}
Copy link

Choose a reason for hiding this comment

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

Consider using a more descriptive placeholder than 'Unknown' for missing scorecard details to provide clearer context to the user. For example, 'Name not available', 'Type not specified', etc.

@rishabhtc rishabhtc merged commit c6b7f67 into v6 Oct 3, 2025
1 check passed
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.

1 participant