-
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededx:action/improveImprove existing functionality/contentImprove existing functionality/contentx:knowledge/elementaryLittle Exercism knowledge requiredLittle Exercism knowledge requiredx:module/analyzerWork on AnalyzersWork on Analyzersx:size/smallSmall amount of workSmall amount of workx:type/codingWrite code that is not student-facing content (e.g. test-runners, generators, but not exercises)Write code that is not student-facing content (e.g. test-runners, generators, but not exercises)
Description
Describe the incorrectness
I don't think the analyzers advice makes any sense here:
Using a helper method is good practice, because it replaces a cryptic "member call" with a named call that can be documented individually.
The advice assumes a student is using an array - in which case there is complexity to hide and I agree a function as a named abstraction is useful, but in this case a well-named lookup table is serving the same purpose as a function, so the advice makes little sense.
Which exercise
Resistor Duo
Source file(s)
export const decodedValue = (colors) => {
const resistorBands = {
black: 0,
brown: 1,
// ...
grey: 8,
white: 9
}
return resistorBands[colors[0]]*10 + resistorBands[colors[1]];
};
Expected analysis
None. (well at least not on this point)
- You could recommend destructuring of the arguments of course - which I would as a mentor.
- Hoisting the constant to a global.
Additional context
None.
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededx:action/improveImprove existing functionality/contentImprove existing functionality/contentx:knowledge/elementaryLittle Exercism knowledge requiredLittle Exercism knowledge requiredx:module/analyzerWork on AnalyzersWork on Analyzersx:size/smallSmall amount of workSmall amount of workx:type/codingWrite code that is not student-facing content (e.g. test-runners, generators, but not exercises)Write code that is not student-facing content (e.g. test-runners, generators, but not exercises)