-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add npm run quality
script, Update Readme
#97
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"detectObjects": true, | ||
"enforceConst": true, | ||
"reporter": "detailed" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/node_modules | ||
/coverage | ||
node_modules/* | ||
coverage/* | ||
test/feature/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
{ | ||
"extends": "airbnb-base", | ||
"env" : { | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"rules": { | ||
"max-lines-per-function" : ["error", 30] | ||
"max-lines-per-function" : ["error", 30], | ||
"no-plusplus" : ["error", { "allowForLoopAfterthoughts": true }], | ||
"no-console" : ["off"], | ||
"no-unused-vars": [ | ||
"error", | ||
{ | ||
"varsIgnorePattern": "should|expect|Before|After|Given" | ||
} | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules/ | |
.nyc_output/ | ||
coverage/ | ||
coverage.lcov | ||
module-depencency.svg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"threshold": 30, | ||
"identifiers": true, | ||
"literals": true, | ||
"color": true, | ||
"ignore": "coverage", | ||
"minInstances": 2, | ||
"truncate": 100 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"fontSize": "10px", | ||
"backgroundColor" : "#ffffff", | ||
"nodeColor": "#000000", | ||
"edgeColor" : "#000000", | ||
"noDependencyColor" : "#7f7f7f", | ||
"graphVizOptions": { | ||
"G": { | ||
"rankdir": "LR" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ script: | |
- npm run post-unit | ||
- npm run integration | ||
- npm run post-integration | ||
- npm run quality |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,16 +87,20 @@ const changeGitlab = (host) => { | |
}; | ||
|
||
const changeServer = async (options) => { | ||
let { host, port, type } = options; | ||
const { host, port } = options; | ||
let { type } = options; | ||
if (!type) { | ||
const typePrompt = prefPrompts.getServerTypePrompt(); | ||
type = (await inquirer.prompt(typePrompt)).type; | ||
({ type } = (await inquirer.prompt(typePrompt))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why brackets? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have discussed this, sir, but for having everything in a single thread; the MDN documentation says:
|
||
} | ||
if (type === 'ms') { | ||
return changeMainServer(host, port); | ||
} if (type === 'gitlab') { | ||
return changeGitlab(host); | ||
} | ||
return { | ||
name: 'invalid_server', | ||
}; | ||
}; | ||
|
||
const changeLogger = async (options) => { | ||
|
@@ -124,15 +128,19 @@ const changeLogger = async (options) => { | |
const getInput = async (args, options) => { | ||
switch (args.preference) { | ||
case 'changelang': | ||
return await changeLang(options); | ||
return changeLang(options); | ||
case 'changeserver': | ||
return await changeServer(options); | ||
return changeServer(options); | ||
case 'show': | ||
return { | ||
name: 'show_prefs', | ||
}; | ||
case 'logger': | ||
return await changeLogger(options); | ||
return changeLogger(options); | ||
default: | ||
return { | ||
name: 'invalid_command', | ||
}; | ||
} | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,12 +23,16 @@ const onSubmissionPending = () => { | |
}; | ||
|
||
const printTableAndGetScore = (data) => { | ||
const testCaseColWidth = 15; | ||
const statusColWidth = 25; | ||
const scoreColWidth = 15; | ||
|
||
const table = new Table({ | ||
head: [chalk.cyan('Test Case #'), chalk.cyan('Status'), chalk.cyan('Score')], | ||
colWidths: [15, 25, 15], | ||
colWidths: [testCaseColWidth, statusColWidth, scoreColWidth], | ||
}); | ||
let totalScore = 0; | ||
for (i = 0; i < data.marks.length; i++) { | ||
for (let i = 0; i < data.marks.length; ++i) { | ||
totalScore += +data.marks[i]; | ||
table.push([(i + 1), data.comment[i], data.marks[i]]); | ||
} | ||
|
@@ -37,9 +41,9 @@ const printTableAndGetScore = (data) => { | |
}; | ||
|
||
const printStatusAndLog = (data, totalScore) => { | ||
logger.moduleLog('debug', 'Eval Output', `Evaluation logs: ${new Buffer(data.log, 'base64').toString()}.`); | ||
logger.moduleLog('debug', 'Eval Output', `Evaluation logs: ${Buffer.from(data.log, 'base64').toString()}.`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Buffer constructor is different depending on the type of its argument, and not validating such arguments might lead to memory disclosure and denial of service. So eslint enforces the use of |
||
|
||
console.log(`\n${chalk.yellow('Log :\n')}${new Buffer(data.log, 'base64').toString()}`); | ||
console.log(`\n${chalk.yellow('Log :\n')}${Buffer.from(data.log, 'base64').toString()}`); | ||
if (data.status !== 0) { | ||
console.log(chalk.red('Penalty : ') + data.penalty); | ||
} else if (data.status === 0) { | ||
|
@@ -71,6 +75,8 @@ const sendOutput = (event) => { | |
stopSpinner(); | ||
onScores(event.details); | ||
break; | ||
default: | ||
console.log(chalk.red('\nInvalid Event')); | ||
} | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint
give errors of the form :when
mocha
env is not set to be true.