exercism / exercism/javascript-analyzer

Improve two-fer: recognise re-assignment

未关闭
#52 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
16
派生
21
平均合并
6 小时 53 分钟
30 天内合并 PR
2

描述

**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.

```javascript
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:

```javascript
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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。