Skip to content

Commit

Permalink
🚀 version 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SleeplessByte committed Sep 24, 2019
1 parent b4b55ba commit 5289450
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.4.1

- Add message (fix) to `reduce` solutions without `slice`
- Add `limit_number_of_colors` extra message when `slice` is an `must_add_missing_call`.

## 0.4.0

- Add analyzer for `resistor-color-duo`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@exercism/javascript-analyzer",
"version": "0.4.0",
"version": "0.4.1",
"description": "Exercism analyzer for javascript",
"repository": "https://github.com/exercism/javascript-analyzer",
"author": "Derk-Jan Karrenbeld <[email protected]>",
Expand Down
13 changes: 11 additions & 2 deletions src/analyzers/resistor-color-duo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,16 @@ export class ResistorColorDuoAnalyzer extends IsolatedAnalyzerImpl {
output.disapprove(ISSUE_METHOD_NOT_FOUND({ 'method.name': lastIssue.methodName }))
} else if (lastIssue instanceof MissingExpectedCall) {
// output.add(BETA_COMMENTARY_PREFIX())
output.disapprove(ISSUE_EXPECTED_CALL({ 'method.name': lastIssue.methodName, 'expected.reason': lastIssue.reason }))
output.add(ISSUE_EXPECTED_CALL({ 'method.name': lastIssue.methodName, 'expected.reason': lastIssue.reason }))

// Add extra information for limit number
if (solution.entry.hasOneMap || solution.entry.hasOneReduce) {
if (!solution.entry.hasOneSlice) {
output.add(LIMIT_NUMBER_OF_COLORS())
}
}

output.disapprove()
} else {
this.logger.error('The analyzer did not handle the issue: ' + JSON.stringify(lastIssue))
output.redirect()
Expand Down Expand Up @@ -238,7 +247,7 @@ export class ResistorColorDuoAnalyzer extends IsolatedAnalyzerImpl {
output.add(PREFER_NUMBER_OVER_PARSE())
}

if (solution.entry.hasOneMap || solution.entry.hasOneSlice) {
if (solution.entry.hasOneMap || solution.entry.hasOneReduce) {
if (!solution.entry.hasOneSlice) {
output.add(LIMIT_NUMBER_OF_COLORS())
}
Expand Down
48 changes: 44 additions & 4 deletions test/analyzers/resistor-color-duo/__snapshots__/snapshot.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,35 @@ IsolatedAnalyzerOutput {
"comments": Array [
CommentImpl {
"externalTemplate": "javascript.resistor-color-duo.must_add_missing_call",
"message": "📕 In order to limit the number of colors processed to 2, expected a \`.slice(0, 2)\` call. If
"message": "📕 In order to limit the number of colors processed to two, expected a \`.slice(0, 2)\` call. If
that reasoning applies, mentor the student to add this call.",
"template": "📕 In order to %{expected.reason}, expected a \`%{method.name}\` call. If
that reasoning applies, mentor the student to add this call.",
"variables": Object {
"expected.reason": "limit the number of colors processed to 2",
"expected.reason": "limit the number of colors processed to two",
"method.name": ".slice(0, 2)",
},
},
CommentImpl {
"externalTemplate": "javascript.resistor-color-duo.limit_number_of_colors",
"message": "💬 Limit the number of input colors that are processed. If more than two colors
are passed in, only the first two colors should be used to calculate the total
\`colorCode\` value.

📕 (At least) one test case inputs three colors instead of two. If the student
has not accounted for this, they might need to update their solution. Help them
find the button to update. The tests won't pass without limiting the number of
colors.",
"template": "💬 Limit the number of input colors that are processed. If more than two colors
are passed in, only the first two colors should be used to calculate the total
\`colorCode\` value.

📕 (At least) one test case inputs three colors instead of two. If the student
has not accounted for this, they might need to update their solution. Help them
find the button to update. The tests won't pass without limiting the number of
colors.",
"variables": Object {},
},
],
"status": "disapprove",
}
Expand Down Expand Up @@ -487,15 +507,35 @@ IsolatedAnalyzerOutput {
"comments": Array [
CommentImpl {
"externalTemplate": "javascript.resistor-color-duo.must_add_missing_call",
"message": "📕 In order to limit the number of colors processed to 2, expected a \`.slice(0, 2)\` call. If
"message": "📕 In order to limit the number of colors processed to two, expected a \`.slice(0, 2)\` call. If
that reasoning applies, mentor the student to add this call.",
"template": "📕 In order to %{expected.reason}, expected a \`%{method.name}\` call. If
that reasoning applies, mentor the student to add this call.",
"variables": Object {
"expected.reason": "limit the number of colors processed to 2",
"expected.reason": "limit the number of colors processed to two",
"method.name": ".slice(0, 2)",
},
},
CommentImpl {
"externalTemplate": "javascript.resistor-color-duo.limit_number_of_colors",
"message": "💬 Limit the number of input colors that are processed. If more than two colors
are passed in, only the first two colors should be used to calculate the total
\`colorCode\` value.

📕 (At least) one test case inputs three colors instead of two. If the student
has not accounted for this, they might need to update their solution. Help them
find the button to update. The tests won't pass without limiting the number of
colors.",
"template": "💬 Limit the number of input colors that are processed. If more than two colors
are passed in, only the first two colors should be used to calculate the total
\`colorCode\` value.

📕 (At least) one test case inputs three colors instead of two. If the student
has not accounted for this, they might need to update their solution. Help them
find the button to update. The tests won't pass without limiting the number of
colors.",
"variables": Object {},
},
],
"status": "disapprove",
}
Expand Down

0 comments on commit 5289450

Please sign in to comment.