IHTSDO/component-identifier-service

View on GitHub

Showing 213 of 1,102 total issues

Function deprecateSctids has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports.deprecateSctids = function deprecateSctids (req, res, next) {
    var token = req.swagger.params.token.value;
    var deprecationData = req.swagger.params.deprecationData.value;
    security.authenticate(token, function(err, data) {
        if (err) {
Severity: Minor
Found in controllers/SctidBulk.js - About 1 hr to fix

    Function setAvailableSCTIDRecord2NewStatus has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function setAvailableSCTIDRecord2NewStatus(operation, callback){
        Sync(function () {
            try {
                var query = {
                    namespace: parseInt(operation.namespace),
    Severity: Minor
    Found in blogic/SCTIdBulkDataManager.js - About 1 hr to fix

      Function getUsers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports.getUsers = function getUsers (req, res, next) {
          var token = req.swagger.params.token.value;
          security.authenticate(token, function(err, data) {
              if (err) {
                  return next({message: err.message, statusCode: 401});
      Severity: Minor
      Found in controllers/Login.js - About 1 hr to fix

        Function counterMode has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function counterMode(operation, action, callback){
        
            getNextNumber(operation, function (err, seq) {
                if (err) {
                    callback(err, null);
        Severity: Minor
        Found in blogic/SCTIdDataManager.js - About 1 hr to fix

          Function counterMode has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function counterMode(scheme, operation, action, callback){
          
              getNextSchemeId(scheme, operation, function (err, newSchemeId) {
                  if (err) {
                      callback(err, null);
          Severity: Minor
          Found in blogic/SchemeIdDataManager.js - About 1 hr to fix

            Function authenticate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports.authenticate = function authenticate (token, callback) {
                if (authenticationCache[token]) {
                    var now = Date.now();
                    var ago = (Date.now() - authenticationCache[token].timestamp);
                    if (ago < (60000*60)) {
            Severity: Minor
            Found in blogic/Security.js - About 1 hr to fix

              Function setNewSchemeIdRecord has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function setNewSchemeIdRecord(operation, thisScheme, callback) {
                  Sync(function () {
                      try {
              
                          var previousCode=thisScheme.idBase;
              Severity: Minor
              Found in blogic/SchemeIdBulkDataManager.js - About 1 hr to fix

                Function setNewSCTIdRecord has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function setNewSCTIdRecord(operation,thisPartition,callback) {
                    Sync(function () {
                        try {
                            //The transaction around the partition sequence number increment 
                            //(and subsequent save to database) is covered
                Severity: Minor
                Found in blogic/SCTIdBulkDataManager.js - About 1 hr to fix

                  Function count has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  sctid.count=function(query,callback){
                  
                      db.getDB(function (err,connection)
                      {
                          if (err) throw err;
                  Severity: Minor
                  Found in model/sctid.js - About 1 hr to fix

                    Function setAvailableSchemeIdRecord2NewStatus has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function setAvailableSchemeIdRecord2NewStatus(operation, thisScheme, callback){
                        Sync(function () {
                            try {
                                var query = {scheme: thisScheme.scheme.toUpperCase(), status: stateMachine.statuses.available};
                    
                    
                    Severity: Minor
                    Found in blogic/SchemeIdBulkDataManager.js - About 1 hr to fix

                      Function setAvailableSchemeIdRecord2NewStatus has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function setAvailableSchemeIdRecord2NewStatus(scheme, operation, action, callback){
                          var query={scheme:scheme, status: stateMachine.statuses.available };
                      
                          schemeid.find(query ,1 ,null, function(err, schemeIdRecords){
                              if (err) {
                      Severity: Minor
                      Found in blogic/SchemeIdDataManager.js - About 1 hr to fix

                        Function setAvailableSCTIDRecord2NewStatus has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function setAvailableSCTIDRecord2NewStatus(operation, action, callback){
                            var query={namespace: parseInt(operation.namespace), partitionId:operation.partitionId, status: stateMachine.statuses.available };
                            sctid.find(query ,1, null,function(err, sctIdRecords){
                                if (err) {
                                    callback(err, null);
                        Severity: Minor
                        Found in blogic/SCTIdDataManager.js - About 1 hr to fix

                          Function generateSchemeIds has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports.generateSchemeIds = function generateSchemeIds (req, res, next) {
                              var token = req.swagger.params.token.value;
                              var schemeName = req.swagger.params.schemeName.value;
                              var generationMetadata = req.swagger.params.generationMetadata.value;
                              security.authenticate(token, function(err, data) {
                          Severity: Minor
                          Found in controllers/SchemeIdBulk.js - About 1 hr to fix

                            Function reserveSctids has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            module.exports.reserveSctids = function reserveSctids (req, res, next) {
                                var token = req.swagger.params.token.value;
                                var reservationData = req.swagger.params.reservationData.value;
                                security.authenticate(token, function(err, data) {
                                    if (err) {
                            Severity: Minor
                            Found in controllers/SctidBulk.js - About 1 hr to fix

                              Function getNextNumber has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function getNextNumber( operation, callback) {
                                  console.log("getNextNumber " + operation.namespace + "," + operation.partitionId);
                                  getModel(function(err) {
                                      if (err) {
                                          callback(err, null);
                              Severity: Minor
                              Found in blogic/SCTIdDataManager.js - About 1 hr to fix

                                Method callCis has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private List<Long> callCis(String operation, CISBulkRequest request, boolean includeSchemeName) throws CISClientException {
                                        String bulkJobId;
                                        String jobInfo = operation;
                                        try {
                                            CISBulkRequestResponse responseBody;
                                Severity: Minor
                                Found in java-client/src/main/java/org/snomed/cis/client/CISClient.java - About 1 hr 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

                                Function registerSctid has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                module.exports.registerSctid = function registerSctid (req, res, next) {
                                    var token = req.swagger.params.token.value;
                                    var registrationData = req.swagger.params.registrationData.value;
                                    security.authenticate(token, function(err, data) {
                                        if (err) {
                                Severity: Minor
                                Found in controllers/Sctid.js - About 1 hr to fix

                                  Function registerNewSctId has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function registerNewSctId(operation, callback){
                                      getSctid(operation.sctid,function(err,sctIdRecord){
                                  
                                          if (err) {
                                              callback(err, null);
                                  Severity: Minor
                                  Found in blogic/SCTIdDataManager.js - About 1 hr to fix

                                    Function getSchemeId has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    var getSchemeId=function (scheme,schemeId, callback){
                                        if (schemeId==null || schemeId==""){
                                            callback(throwErrMessage("Not valid schemeId."),null);
                                            return;
                                        }else{
                                    Severity: Minor
                                    Found in blogic/SchemeIdDataManager.js - About 1 hr to fix

                                      Function registerNewSchemeId has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      function registerNewSchemeId(scheme, operation, callback){
                                          getSchemeId(scheme, operation.schemeId,function(err,schemeIdRecord){
                                      
                                              if (err) {
                                                  callback(err, null);
                                      Severity: Minor
                                      Found in blogic/SchemeIdDataManager.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language