javascript-analyzer icon indicating copy to clipboard operation
javascript-analyzer copied to clipboard

Improve two-fer: recognise re-assignment

Open SleeplessByte opened this issue 5 years ago • 5 comments

Is your feature request related to a problem? Please describe.

When a solution is provided with a re-assignment, the analyzer bails out of a lot of code paths.

export function twoFer(name = 'you') {
  const whomst = name
  return `One for me, and one for ${whomst}.`
}

When a solution is provided with a re-assignment of the named argument, the analyzer doesn't recognise the shadowing:

export function twoFer(name) {
  name = name ? name : "you"
  return `One for me, and one for ${name}.`
}

Which exercise two-fer

Describe the solution you'd like

Simple re-assignments like the one above should be recognised and disapproved. They don't add any value to the solution.

Re-assignments of the named arguments should be recognised and disapproved. https://github.com/exercism/javascript-analyzer/issues/52#issuecomment-750298061

SleeplessByte avatar Sep 26 '19 11:09 SleeplessByte