IHTSDO/component-identifier-service

View on GitHub

Showing 213 of 1,102 total issues

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

sctid.updateJobId=function(existingSystemId, jobId, callback){

    db.getDB(function (err,connection)
    {
        if (err) {
Severity: Minor
Found in model/sctid.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 (!data) {
                                        callback("Partition not found for key:" + JSON.stringify(key));
                                        return;
                                    }
Severity: Major
Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

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

      Avoid deeply nested control flow statements.
      Open

                              if (i > -1 && i < records.length) {
                                  console.log("pos i:" + i);
      
                                  var key = [parseInt(operation.namespace), operation.partitionId.toString()];
                                  var seq = null;
      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

                                  for (CISPartition sourcePartition : sourcePartitions) {
                                      CISPartition targetPartition = targetPartitionMap.get(sourcePartition.getPartitionId());
                                      if (targetPartition != null) {
                                          System.out.println("Source Partition:" + sourcePartition.toString());
                                          System.out.println("Target Partition:" + targetPartition.toString());

            Avoid deeply nested control flow statements.
            Open

                                        if (err) {
                                            console.log("Error accessing groups", err);
                                            callback(able);
                                        } else {
                                            result.forEach(function(loopGroup){
            Severity: Major
            Found in controllers/SchemeIdBulk.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (err) {
                                              console.log("Error accessing groups", err);
                                              callback(able);
                                          } else {
                                              result.forEach(function(loopGroup){
              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

                  Avoid deeply nested control flow statements.
                  Open

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

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

                    var getSchemeId=function (scheme, schemeId, systemId, autoSysId, callback) {
                        Sync(function () {
                            if (!schemes[scheme.toUpperCase()].validSchemeId(schemeId)){
                    
                                callback("Not valid SchemeId: " + schemeId, null);
                    Severity: Minor
                    Found in blogic/SchemeIdBulkDataManager.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) {
                                                    console.log("Error accessing groups", err);
                                                    callback(able);
                                                } else {
                                                    result.forEach(function(loopGroup){
                    Severity: Major
                    Found in controllers/SctidBulk.js - About 45 mins to fix

                      Function findFieldSelect has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      job.findFieldSelect=function(query, fields,limit, skip,orderBy, callback){
                      Severity: Minor
                      Found in model/job.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 (diff) {
                                                              sysIdToCreate = diff;
                                                          }
                          Severity: Major
                          Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                                    if (sctIdRecord != null) {
                                                                        sctIdRecord.jobId = operation.jobId;
                                                                        sctid.save.sync(null,sctIdRecord);
                                                                        canContinue = false;
                                                                    }
                            Severity: Major
                            Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if (err) {
                                                              console.log("Error accessing groups", err);
                                                              callback(able);
                                                          } else {
                                                              result.forEach(function(loopGroup){
                              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/Sctid.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                              if (err) {
                                                                  console.log("Error accessing groups", err);
                                                                  callback(able);
                                                              } else {
                                                                  result.forEach(function(loopGroup){
                                  Severity: Major
                                  Found in controllers/SctidBulk.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if (res) {
                                                            var syscode = res[0];
                                                            var i = -1;
                                                            for (i = 0; i < records.length; i++) {
                                                                if (records[i][5] == syscode) {
                                    Severity: Major
                                    Found in blogic/SCTIdBulkDataManager.js - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language