IHTSDO/component-identifier-service

View on GitHub

Showing 213 of 1,102 total issues

Avoid deeply nested control flow statements.
Open

                                if (!thisPartition) {
                                    callback("Partition not found for key:" + JSON.stringify(key));
                                    return;
                                }
Severity: Major
Found in blogic/IdReposition.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                    if (err) {
                                        error = true;
                                        callback(err);
                                        return;
                                    }
    Severity: Major
    Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                                  if (err) {
                                                      callback(err);
                                                  } else {
                                                      callback(null);
                                                  }
      Severity: Major
      Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if (cont == records.length) {
                                            callback(null);
                                            return;
        
                                        }
        Severity: Major
        Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                                      if (err) {
          
                                                          return next(err.message);
                                                      }
          Severity: Major
          Found in controllers/Sctid.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                                            if (err) {
            
                                                                return next(err.message);
                                                            }
            Severity: Major
            Found in controllers/SctidBulk.js - About 45 mins to fix

              Function getSctid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              var getSctid=function (sctId, systemId, callback) {
                  Sync(function () {
              
                      if (!sctIdHelper.validSCTId(sctId)) {
                          callback("Not valid SCTID:" + sctId, null);
              Severity: Minor
              Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Avoid deeply nested control flow statements.
              Open

                                                  if (err) {
                                                      callback(err);
                                                  } else {
                                                      var count = 0;
                                                      Sync(function () {
              Severity: Major
              Found in blogic/IdReposition.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                if (ret){
                                                    throw ret;
                                                }
                Severity: Major
                Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          for (var j = 0; j < records.length; j++) {
                  
                                              sctid.save(records[j], function (err) {
                                                  if (err) {
                                                      error = true;
                  Severity: Major
                  Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                        if (total > 0){
                                                            namespaceResult.forEach(function(namespaceR){
                                                                sctid.count({namespace: namespaceR.namespace}, function (err, namespaceCount){
                                                                    if (err)
                                                                        callback(err, null);
                    Severity: Major
                    Found in blogic/HomeDataManager.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                                      if (err) {
                                                                          var str = "[ERROR] " + (new Date()).getTime() + ": namespace=" + namespace + ", partition=" + partitionId + ". " + err;
                                                                          console.log(str);
                                                                      }
                      Severity: Major
                      Found in blogic/BulkIdCreation.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                                        if (err) {
                                                                            var str = "[ERROR] " + (new Date()).getTime() + ": namespace=" + namespace + ", partition=" + partitionId + ". " + err;
                                                                            console.log(str);
                                                                        }
                        Severity: Major
                        Found in blogic/BulkIdCreation.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                          if (existingSysIds && existingSysIds.length > 0) {
                          
                                                              sctid.updateJobId.sync(null, existingSysIds, operation.jobId);
                          
                                                              if (existingSysIds.length < sysIdInChunk.size()) {
                          Severity: Major
                          Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                                if (namespacesFromGroup.length){
                                                                    namespacesFromGroup.forEach(function (namespLoop) {
                                                                        var found = false;
                                                                        namespaceResult.forEach(function(namesp){
                                                                            if (namesp.namespace == namespLoop)
                            Severity: Major
                            Found in blogic/HomeDataManager.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if (limit && limit > 0 && limit < cont) {
                                                              break;
                                                          }
                              Severity: Major
                              Found in model/sctid.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                                    if (existingSctIds.length < sctIdInChunk.size()) {
                                                                        var setExistSctId = new sets.StringSet(existingSctIds);
                                
                                                                        diff = sctIdInChunk.difference(setExistSctId).array();
                                                                        insertedCount += setExistSctId.size();
                                Severity: Major
                                Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

                                  Function editScheme has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  module.exports.editScheme = function editScheme(id, schemeSeq, callback) {
                                      dbInit.getDB(function (err, pdb, model) {
                                          if (err)
                                              throw err;
                                          else{
                                  Severity: Minor
                                  Found in blogic/SchemeDataManager.js - About 45 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if (typeof err == "object") {
                                                              lightJob.log = JSON.stringify(err);
                                                          } else {
                                                              lightJob.log = err;
                                                          }
                                  Severity: Major
                                  Found in blogic/BackEndJobService.js - About 45 mins to fix

                                    Function editPartition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    module.exports.editPartition = function editPartition(ids, editedSequence, callback) {
                                        dbInit.getDB(function (err, pdb, model) {
                                            if (err)
                                                throw err;
                                            else{
                                    Severity: Minor
                                    Found in blogic/NamespaceDataManager.js - About 45 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language