exercism / exercism/javascript-analyzer

Improve two-fer: recognise re-assignment

オープン
#52 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
16
フォーク
21
平均マージ
6時間 53分
マージ済み PR(30日)
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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、`two-fer` 演習の analyzer ロジックを追跡し、名前付き引数への代入をどのように処理しているかを確認します。Issue にある 2 つの例を比較し、次に単純な再代入のカバレッジを追加して、そのような解決策が却下されることを確認します。Payload にはソースファイルもテストパスも記載されていません。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript
領域
testing, tooling
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。