caverav / auditforge

Logical operator can be refactored to optional chain JS-W1044
Anti-pattern
Minor
11 days ago11 days old
Prefer using an optional chain expression instead, as it's more concise and easier to read
 649            var sortOption = row.sortFindings.find(
 650              e => e.category === (finding.category || 'No Category'),
 651            );
 652            if ((sortOption && sortOption.sortAuto) || !sortOption) 653              // if sort is set to automatic or undefined then we sort (default sort will be applied to undefined sortOption)
 654              return Audit.updateSortFindings(isAdmin, auditId, userId, null);
 655            // if manual sorting then we do not sort
Prefer using an optional chain expression instead, as it's more concise and easier to read
 549// Update audit general information
 550AuditSchema.statics.updateGeneral = (isAdmin, auditId, userId, update) => {
 551  return new Promise(async (resolve, reject) => {
 552    if (update.company && update.company.name) { 553      var Company = mongoose.model('Company');
 554      try {
 555        update.company = await Company.create({ name: update.company.name });
Prefer using an optional chain expression instead, as it's more concise and easier to read
173                        }}
174                        placeholder={t('search')}
175                        type="text"
176                        value={(filters && filters[column.accessor]) ?? ''}177                      />
178                    ) : null}
179                  </div>
Prefer using an optional chain expression instead, as it's more concise and easier to read
58      client.cell = req.body.cell || null;
59      client.title = req.body.title || null;
60      var company = null;
61      if (req.body.company && req.body.company.name)62        company = req.body.company.name;
63
64      Client.update(req.params.id, client, company)
Prefer using an optional chain expression instead, as it's more concise and easier to read
35      if (req.body.cell) client.cell = req.body.cell;
36      if (req.body.title) client.title = req.body.title;
37      var company = null;
38      if (req.body.company && req.body.company.name)39        company = req.body.company.name;
40
41      Client.create(client, company)