Skip to content

Add script for analyzing remote content#42

Merged
SleeplessByte merged 2 commits intomasterfrom
chore/remote-analyze
Sep 26, 2019
Merged

Add script for analyzing remote content#42
SleeplessByte merged 2 commits intomasterfrom
chore/remote-analyze

Conversation

@SleeplessByte
Copy link
Copy Markdown
Member

bin/remote.sh https://exercism.io/mentor/solutions/3b601a60afac4ed097a363d2b9b7dc38 -dc --noTemplates

Requires the exercism cli tool to be accessible as well as the download folder. This does not execute the code and is therefore pretty safe.

Together with #41, this can be used to test how the analysers will deal with a certain solution, before it's deployed.

=> DEBUG mode is on
=> input: https://exercism.io/mentor/solutions/3b601a60afac4ed097a363d2b9b7dc38
~> exercism uuid: 3b601a60afac4ed097a363d2b9b7dc38
-> executing node -r esm -r module-alias/register "<..>\exercism-javascript-analyzer\dist\analyze.js" gigasecond "<..>\Exercism\users\<..>\javascript\gigasecond" -dc --noTemplates
=> DEBUG mode is on
=> exercise: gigasecond
=> analyzer: GigasecondAnalyzer
=> inputs: 1
//
// This is only a SKELETON file for the 'Gigasecond' exercise. It's been provided as a
// convenience to get you started writing code faster.
//

export const gigasecond = (localeDate) => {
  return new Date( localeDate.getTime() + Math.pow(10, 12) );
};
~> Solution is not optimal
{
  "isOneLineSolution": true,
  "isUsingGetTimeOnce": true,
  "isUsingNewDateOnce": true,
  "findExtractedNumberConstant": false,
  "isUsingLargeNumberLiteral": true,
  "isUsingIntermediateVariable": false
}
=> early finialization (approve)
=> output:

{"status":"approve","comments":[{"comment":"Consider extracting the gigasecond number into a constant:\n\n```javascript\nconst %<name>s = %<value>s\n\nexport const gigasecond = (...)\n```","params":{"name":"GIGASECOND_IN_MS","value":"1000000000000"}},{"comment":"You can rewrite the literal `%<literal>s` using `Math.pow` or `10 ** n`,\nwhich makes it more readable.","params":{"literal":"1000000000000"}}]}

=> writing output to <..>\Exercism\users\<..>\javascript\gigasecond\analysis.json

@SleeplessByte SleeplessByte merged commit b0f54fe into master Sep 26, 2019
@SleeplessByte SleeplessByte deleted the chore/remote-analyze branch September 26, 2019 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant