Showing 213 of 1,102 total issues
Function deprecateSctids
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function setAvailableSCTIDRecord2NewStatus
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setAvailableSCTIDRecord2NewStatus(operation, callback){
Sync(function () {
try {
var query = {
namespace: parseInt(operation.namespace),
Function getUsers
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
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});
Function counterMode
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function counterMode(operation, action, callback){
getNextNumber(operation, function (err, seq) {
if (err) {
callback(err, null);
Function counterMode
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function counterMode(scheme, operation, action, callback){
getNextSchemeId(scheme, operation, function (err, newSchemeId) {
if (err) {
callback(err, null);
Function authenticate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)) {
Function setNewSchemeIdRecord
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setNewSchemeIdRecord(operation, thisScheme, callback) {
Sync(function () {
try {
var previousCode=thisScheme.idBase;
Function setNewSCTIdRecord
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setNewSCTIdRecord(operation,thisPartition,callback) {
Sync(function () {
try {
//The transaction around the partition sequence number increment
//(and subsequent save to database) is covered
Function count
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
sctid.count=function(query,callback){
db.getDB(function (err,connection)
{
if (err) throw err;
Function setAvailableSchemeIdRecord2NewStatus
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setAvailableSchemeIdRecord2NewStatus(operation, thisScheme, callback){
Sync(function () {
try {
var query = {scheme: thisScheme.scheme.toUpperCase(), status: stateMachine.statuses.available};
Function setAvailableSchemeIdRecord2NewStatus
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function setAvailableSCTIDRecord2NewStatus
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Function generateSchemeIds
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function reserveSctids
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function getNextNumber
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getNextNumber( operation, callback) {
console.log("getNextNumber " + operation.namespace + "," + operation.partitionId);
getModel(function(err) {
if (err) {
callback(err, null);
Method callCis
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
private List<Long> callCis(String operation, CISBulkRequest request, boolean includeSchemeName) throws CISClientException {
String bulkJobId;
String jobInfo = operation;
try {
CISBulkRequestResponse responseBody;
- Read upRead up
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
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) {
Function registerNewSctId
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function registerNewSctId(operation, callback){
getSctid(operation.sctid,function(err,sctIdRecord){
if (err) {
callback(err, null);
Function getSchemeId
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var getSchemeId=function (scheme,schemeId, callback){
if (schemeId==null || schemeId==""){
callback(throwErrMessage("Not valid schemeId."),null);
return;
}else{
Function registerNewSchemeId
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function registerNewSchemeId(scheme, operation, callback){
getSchemeId(scheme, operation.schemeId,function(err,schemeIdRecord){
if (err) {
callback(err, null);