-
Notifications
You must be signed in to change notification settings - Fork 779
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
feat: generated impacts as a part of rule descriptions #898
Conversation
@WilcoFiers - review please. Amendment as requested in place. |
build/configure.js
Outdated
} | ||
|
||
var cumulativeScores = getUniqueArr( | ||
getScore(rule.any, true) // Any: get highest impact |
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.
Some squirrely comment spacing here.
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.
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.
refactored so no more beautiful
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.
Looks good, Jey.
var id = typeof check === 'string' ? check : check.id; | ||
var definition = clone(findCheck(checks, id)); | ||
if (!definition) { | ||
grunt.log.error('check ' + id + ' not found'); |
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.
Should we stop execution and return
here?
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.
Unsure, not a blocker so leaving as is, until I read up grunt docs.
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.
No objections, just a topic of worth discussing
build/configure.js
Outdated
function parseImpactForRule(rule) { | ||
|
||
|
||
function capitalize(s) { |
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.
I'm finding it difficult to review code that has nested functions like this. Github won't let me collapse this so I can't simply skip over them when reviewing the outer-most function. The point of abstracting is to let me skip over some of the details, but this way I have to consider multiple scopes when reading through this. I find this is harder to read than it even would have been if the abstractions weren't put in here at all. I'd much prefer that any function that can be moved to the top of the file be moved there.
@isner @stephendonner WDYT? Is that just me?
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.
While I agree, this seems to be the existing code-style. We tend to nest function declarations a lot.
Don't think this should necessarily be a blocker, but maybe others feel differently. ¯_(ツ)_/¯
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.
Ignoring above for now, until we reach a consensus...
build/configure.js
Outdated
getScore(rule.any, true) // Any: get highest impact | ||
.concat(getScore(rule.all, false)) // All: get all unique | ||
.concat(getScore(rule.none, false)) // None: get all unique | ||
).sort().reverse(); //order highest to lowest |
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.
I would think lowest to highest. Not a big deal though.
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.
Sorted - lowest to highest...
build/configure.js
Outdated
var scores = getImpactScores(checkCollection); | ||
if(scores && scores.length) { | ||
return onlyHighestScore | ||
? [Math.max.apply(null, scores)] |
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.
Might read better as:
[Math.max(...scores)]
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.
This file is not es6 friendly, leaving it as is...
PR Checklist
Please check if your PR fulfills the following requirements:
Description of the changes
Does this PR introduce a breaking change?
Other information
@WilcoFiers - can you point me to the issue for the same?