exercism / exercism/javascript-analyzer

Improve resistor-color-duo: detect string concat

未關閉
#55 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
16
分支
20
平均合併
6 小時 53 分鐘
30 天內合併 PR
2

描述

**Describe the improvement**:

When the following main method is provided, the analyzer bails early:

```javascript
export const value = arr => {
return +(COLORS.indexOf(arr[0]) + "" + COLORS.indexOf(arr[1]));
};
```

Instead, it should be caught by `hasDigitsString`, and produce the same comment.

**Which exercise**

`resistor-color-duo`

**Additional context**

The `ResistorColorDuoSolution` has a method that checks if an exercise _has a constructed string_. It currently only detects a string template literal that looks like `${a}${b}`, but we want to also capture the following:

```javascript
`${a}` + `${b}`
a + "" + b
a + '' + b
"" + a + b
'' + a + b
a.toString() + b
a.toString() + b.toString()
a.toString().concat(b)
```

貢獻指南

開啟貢獻指南

研究方向

閱讀 ResistorColorDuoSolution 和 hasDigitsString 檢查,然後檢查 resistor-color-duo exercise 的分析方式。重現提供的 main method,並將其輸出與現有的 template-literal case 進行比較。當分析器能夠識別所列出的 string-construction forms,並在不提前退出的情況下產生相同的 comment 時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript, typescript
領域
tooling
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。