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

Update helper method issue to indicate not to use a helper function #162

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/analyzers/practice/resistor-color-duo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,9 @@ to retrieve their solution and/or optimise their helper.
`('javascript.resistor-color-duo.must_optimise_helper', CommentType.Actionable)

const ISSUE_USE_A_HELPER = factory`
📕 Mentor the student to add helper function and DRY-up this solution. The
solution to \`resistor-color\` can be used as helper method here. When using an
\`Array\` as colors source, in a years time, will the student recall why it's
the _index_ in that array? When using an \`Object\`, what does the value mean?
Re-using \`colorCode\` explains this in both cases.

💬 Using a helper method is good practice, because it replaces a cryptic "member
call" with a named call, that can be documented individually.
📕 Mentor the student to use a lookup table instead of a helper function. A well-named lookup table can provide clarity and efficiency without the need for an additional function.

💬 Using a lookup table is sufficient for this exercise, as it directly maps color names to their corresponding values.
`('javascript.resistor-color-duo.must_use_a_helper', CommentType.Actionable)

const ISSUE_METHOD_NOT_FOUND = factory<'method.name'>`
Expand Down