File catalog-remote.js
has 735 lines of code (exceeds 250 allowed). Consider refactoring. Open
var _ = require('underscore');
var sqlite3 = require('sqlite3');
var files = require('../../fs/files');
var utils = require('../../utils/utils.js');
`` has 36 functions (exceeds 20 allowed). Consider refactoring. Open
Object.assign(RemoteCatalog.prototype, {
toString: function () {
var self = this;
return "RemoteCatalog";
},
Function runInTransaction
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
runInTransaction: function (action) {
var self = this;
var runOnce = Profile("sqlite query", function () {
var txn = new Txn(self);
- 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 runInTransaction
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
runInTransaction: function (action) {
var self = this;
var runOnce = Profile("sqlite query", function () {
var txn = new Txn(self);
Function initialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function (options) {
var self = this;
options = options || {};
// We should to figure out if we are intending to connect to the package server.
Function _query
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
_query: function (sql, params) {
var self = this;
var prepared = null;
var prepare = self._autoPrepare && !_.isEmpty(params);
- 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 _execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_execute: function (sql, params) {
var self = this;
var prepared = null;
// We don't prepare non-parametrized statements, because (a) there's not
- 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 _execute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
_execute: function (sql, params) {
var self = this;
var prepared = null;
// We don't prepare non-parametrized statements, because (a) there's not
Function refresh
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
refresh: function (options) {
var self = this;
options = options || {};
Console.debug("In remote catalog refresh");
Function refresh
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
refresh: function (options) {
var self = this;
options = options || {};
Console.debug("In remote catalog refresh");
- 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 runOnce
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var runOnce = Profile("sqlite query", function () {
var txn = new Txn(self);
var t1 = Date.now();
Function _query
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_query: function (sql, params) {
var self = this;
var prepared = null;
var prepare = self._autoPrepare && !_.isEmpty(params);
Function _retry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_retry: function (f, options) {
options = Object.assign({ maxAttempts: 3, delay: 500}, options || {});
for (var attempt = 1; attempt <= options.maxAttempts; attempt++) {
try {
- 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 createTable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
createTable: function (txn) {
var self = this;
var sql = 'CREATE TABLE IF NOT EXISTS ' + self.name + '(';
for (var i = 0; i < self.jsonFields.length; i++) {
- 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"