Skip to content

Commit 5289450

Browse files
committed
🚀 version 0.4.1
1 parent b4b55ba commit 5289450

File tree

4 files changed

+61
-7
lines changed

4 files changed

+61
-7
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.4.1
4+
5+
- Add message (fix) to `reduce` solutions without `slice`
6+
- Add `limit_number_of_colors` extra message when `slice` is an `must_add_missing_call`.
7+
38
## 0.4.0
49

510
- Add analyzer for `resistor-color-duo`

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@exercism/javascript-analyzer",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "Exercism analyzer for javascript",
55
"repository": "https://github.com/exercism/javascript-analyzer",
66
"author": "Derk-Jan Karrenbeld <[email protected]>",

src/analyzers/resistor-color-duo/index.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,16 @@ export class ResistorColorDuoAnalyzer extends IsolatedAnalyzerImpl {
205205
output.disapprove(ISSUE_METHOD_NOT_FOUND({ 'method.name': lastIssue.methodName }))
206206
} else if (lastIssue instanceof MissingExpectedCall) {
207207
// output.add(BETA_COMMENTARY_PREFIX())
208-
output.disapprove(ISSUE_EXPECTED_CALL({ 'method.name': lastIssue.methodName, 'expected.reason': lastIssue.reason }))
208+
output.add(ISSUE_EXPECTED_CALL({ 'method.name': lastIssue.methodName, 'expected.reason': lastIssue.reason }))
209+
210+
// Add extra information for limit number
211+
if (solution.entry.hasOneMap || solution.entry.hasOneReduce) {
212+
if (!solution.entry.hasOneSlice) {
213+
output.add(LIMIT_NUMBER_OF_COLORS())
214+
}
215+
}
216+
217+
output.disapprove()
209218
} else {
210219
this.logger.error('The analyzer did not handle the issue: ' + JSON.stringify(lastIssue))
211220
output.redirect()
@@ -238,7 +247,7 @@ export class ResistorColorDuoAnalyzer extends IsolatedAnalyzerImpl {
238247
output.add(PREFER_NUMBER_OVER_PARSE())
239248
}
240249

241-
if (solution.entry.hasOneMap || solution.entry.hasOneSlice) {
250+
if (solution.entry.hasOneMap || solution.entry.hasOneReduce) {
242251
if (!solution.entry.hasOneSlice) {
243252
output.add(LIMIT_NUMBER_OF_COLORS())
244253
}

test/analyzers/resistor-color-duo/__snapshots__/snapshot.ts.snap

+44-4
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,35 @@ IsolatedAnalyzerOutput {
244244
"comments": Array [
245245
CommentImpl {
246246
"externalTemplate": "javascript.resistor-color-duo.must_add_missing_call",
247-
"message": "📕 In order to limit the number of colors processed to 2, expected a \`.slice(0, 2)\` call. If
247+
"message": "📕 In order to limit the number of colors processed to two, expected a \`.slice(0, 2)\` call. If
248248
that reasoning applies, mentor the student to add this call.",
249249
"template": "📕 In order to %{expected.reason}, expected a \`%{method.name}\` call. If
250250
that reasoning applies, mentor the student to add this call.",
251251
"variables": Object {
252-
"expected.reason": "limit the number of colors processed to 2",
252+
"expected.reason": "limit the number of colors processed to two",
253253
"method.name": ".slice(0, 2)",
254254
},
255255
},
256+
CommentImpl {
257+
"externalTemplate": "javascript.resistor-color-duo.limit_number_of_colors",
258+
"message": "💬 Limit the number of input colors that are processed. If more than two colors
259+
are passed in, only the first two colors should be used to calculate the total
260+
\`colorCode\` value.
261+
262+
📕 (At least) one test case inputs three colors instead of two. If the student
263+
has not accounted for this, they might need to update their solution. Help them
264+
find the button to update. The tests won't pass without limiting the number of
265+
colors.",
266+
"template": "💬 Limit the number of input colors that are processed. If more than two colors
267+
are passed in, only the first two colors should be used to calculate the total
268+
\`colorCode\` value.
269+
270+
📕 (At least) one test case inputs three colors instead of two. If the student
271+
has not accounted for this, they might need to update their solution. Help them
272+
find the button to update. The tests won't pass without limiting the number of
273+
colors.",
274+
"variables": Object {},
275+
},
256276
],
257277
"status": "disapprove",
258278
}
@@ -487,15 +507,35 @@ IsolatedAnalyzerOutput {
487507
"comments": Array [
488508
CommentImpl {
489509
"externalTemplate": "javascript.resistor-color-duo.must_add_missing_call",
490-
"message": "📕 In order to limit the number of colors processed to 2, expected a \`.slice(0, 2)\` call. If
510+
"message": "📕 In order to limit the number of colors processed to two, expected a \`.slice(0, 2)\` call. If
491511
that reasoning applies, mentor the student to add this call.",
492512
"template": "📕 In order to %{expected.reason}, expected a \`%{method.name}\` call. If
493513
that reasoning applies, mentor the student to add this call.",
494514
"variables": Object {
495-
"expected.reason": "limit the number of colors processed to 2",
515+
"expected.reason": "limit the number of colors processed to two",
496516
"method.name": ".slice(0, 2)",
497517
},
498518
},
519+
CommentImpl {
520+
"externalTemplate": "javascript.resistor-color-duo.limit_number_of_colors",
521+
"message": "💬 Limit the number of input colors that are processed. If more than two colors
522+
are passed in, only the first two colors should be used to calculate the total
523+
\`colorCode\` value.
524+
525+
📕 (At least) one test case inputs three colors instead of two. If the student
526+
has not accounted for this, they might need to update their solution. Help them
527+
find the button to update. The tests won't pass without limiting the number of
528+
colors.",
529+
"template": "💬 Limit the number of input colors that are processed. If more than two colors
530+
are passed in, only the first two colors should be used to calculate the total
531+
\`colorCode\` value.
532+
533+
📕 (At least) one test case inputs three colors instead of two. If the student
534+
has not accounted for this, they might need to update their solution. Help them
535+
find the button to update. The tests won't pass without limiting the number of
536+
colors.",
537+
"variables": Object {},
538+
},
499539
],
500540
"status": "disapprove",
501541
}

0 commit comments

Comments
 (0)