Skip to content

Incorrect Analysis: resistor-color-duo #50

@SleeplessByte

Description

@SleeplessByte

Describe the incorrectness
The helper colorCode is optimal, yet the comment is:

The helper method `colorCode` is not optimal. The helper can probably be the same as the
solution to `resistor-color`. Mentor the student to retrieve their solution and/or optimise 
their helper.

⚡ Warning: We cannot guarantee the analyzer worked correctly on this point. Please 
double-check if it made a mistake, and if it did please open an issue here so the analyzer 
can be updated.

Which exercise

Which exercise
resistor-color-duo

Source file(s)

export const value = (colors) => {
  return Number(
    colors.
      slice(0,2).
      map(colorCode).
      join('')
    )
};

const colorCode = (color) => COLORS.indexOf(color);

const COLORS = [
  "black",
  "brown",
  "red",
  "orange",
  "yellow",
  "green",
  "blue",
  "violet",
  "grey",
  "white"
];

Expected analysis
Approved

Additional context

The actual issue is as follows:

  • the helper is only marked as optimal if it's exported, but that's incorrect. In this exercise, it should NOT be exported.
  • the helper is also determined as "first constant that is not value, which is probably not what we want.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions