caverav / auditforge

Prefer var declarations be placed at the top of their scope JS-0102
Anti-pattern
Minor
11 days ago11 days old
All 'var' declarations must be at the top of the function scope
268 *** Methods ***
269 */
270
271var Vulnerability = mongoose.model('Vulnerability', VulnerabilitySchema);272module.exports = Vulnerability;
All 'var' declarations must be at the top of the function scope
229            });
230          else {
231            primeVuln = row;
232            var removeIndex = mergeVuln.details233              .map(d => d.title)234              .indexOf(mergeDetail.title);235            mergeVuln.details.splice(removeIndex, 1);
236            if (mergeVuln.details.length === 0)
237              return Vulnerability.findByIdAndDelete(mergeVuln._id);
All 'var' declarations must be at the top of the function scope
214        else {
215          mergeVuln = row;
216          mergeDetail = row.details.find(d => d.locale === locale);
217          var query = Vulnerability.findById(vulnIdPrime);218          return query.exec();
219        }
220      })
All 'var' declarations must be at the top of the function scope
176          rows.forEach(row => {
177            row.details.forEach(detail => {
178              if (detail.locale === locale && detail.title) {
179                var temp = {};180                temp.cvssv3 = row.cvssv3;
181                temp.priority = row.priority;
182                temp.remediationComplexity = row.remediationComplexity;
All 'var' declarations must be at the top of the function scope
172      .exec()
173      .then(rows => {
174        if (rows) {
175          var result = [];176          rows.forEach(row => {
177            row.details.forEach(detail => {
178              if (detail.locale === locale && detail.title) {