Skip to content

Conversation

@jmgasper
Copy link
Collaborator

@jmgasper jmgasper commented Nov 4, 2025

… the reviewers section

const normalizeTrackForScorecards = (challenge, metadata) => {
const normalize = (value) => {
if (!value) return null
const normalized = value.toString().trim().toUpperCase().replace(/\s+/g, '_')
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The use of replace(/\s+/g, '_') could lead to unexpected behavior if the input contains multiple spaces. Consider using replace(/\s+/g, '_') to ensure consistent normalization.


if (!challenge) return null

if (challenge.trackId && metadata && Array.isArray(metadata.challengeTracks)) {
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The function normalizeTrackForScorecards returns null if challenge is falsy, but this might not be the desired behavior if metadata is provided. Consider handling the case where metadata is valid even if challenge is not.


loadScorecards () {
const { challenge, loadScorecards } = this.props
const { challenge, loadScorecards, 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.

[❗❗ correctness]
The loadScorecards function now depends on metadata, but it doesn't check if metadata is defined before using it. Consider adding a check to ensure metadata is not undefined to avoid potential runtime errors.

workflows: PropTypes.array,
resourceRoles: PropTypes.array
resourceRoles: PropTypes.array,
challengeTracks: PropTypes.array
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The addition of challengeTracks to PropTypes suggests that it is used in the component, but there is no validation for its presence when used in normalizeTrackForScorecards. Consider adding validation to ensure challengeTracks is provided when expected.

@jmgasper jmgasper merged commit 2596dce into master Nov 4, 2025
8 of 9 checks 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.

2 participants