Showing 131 of 363 total issues
Function checkGrantPermissions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
checkGrantPermissions: async (data, etrx = undefined) => {
let trx;
try {
trx = etrx ? etrx : await Bucket.startTransaction();
Function initializeConnections
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initializeConnections() {
// Initialize connections and exit if unsuccessful
dataConnection.checkAll()
.then(results => {
state.connections.data = results;
Function modifiers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static get modifiers() {
return {
filterKey(query, value) {
const subqueries = [];
if (value.metadata && Object.keys(value.metadata).length) {
- 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 syncJob
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
syncJob: async (path, bucketId, full = false, userId = SYSTEM_USER) => {
try {
if (!path) throw new Error('Path must be defined');
return await utils.trxWrapper(async (trx) => {
- 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 replaceTags
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
replaceTags: async (versionId, tags, currentUserId = SYSTEM_USER, etrx = undefined) => {
let trx;
try {
trx = etrx ? etrx : await Tag.startTransaction();
let response = [];
- 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 addPermissions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
addPermissions: async (bucketId, data, currentUserId = SYSTEM_USER, etrx = undefined) => {
if (!bucketId) {
throw new Error('Invalid bucketId supplied');
}
if (!data || !Array.isArray(data) || !data.length) {
- 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 addPermissions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
addPermissions: async (objId, data, currentUserId = SYSTEM_USER, etrx = undefined) => {
if (!objId) {
throw new Error('Invalid objId supplied');
}
if (!data || !Array.isArray(data) || !data.length) {
- 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 modifiers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static get modifiers() {
return {
filterKey(query, value) {
const subqueries = [];
if (value.tag && Object.keys(value.tag).length) {
- 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 updateIsLatest
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateIsLatest: async (objectId, etrx = undefined) => {
// TODO: consider having accepting a `userId` argument for version.updatedBy when a version becomes 'latest'
let trx;
try {
trx = etrx ? etrx : await Version.startTransaction();
Function associateTags
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
associateTags: async (versionId, tags, currentUserId = SYSTEM_USER, etrx = undefined) => {
let trx;
try {
trx = etrx ? etrx : await Tag.startTransaction();
let response = [];
Function errorToProblem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function errorToProblem(service, e) {
// If already problem type, just return as is
if (e instanceof Problem) {
return e;
} else if (e.response) {
Function _processS3Headers
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_processS3Headers(s3Resp, res) {
// TODO: Consider adding 'x-coms-public' and 'x-coms-path' headers into API spec?
const exposedHeaders = [];
if (s3Resp.ContentLength) res.set('Content-Length', s3Resp.ContentLength);
Function down
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.down = function (knex) {
return Promise.resolve()
// additional DB update: change user.identityId field back
// NOTE: Destructive change - removes all data in identityId column
.then(() => knex('user').update({ identityId: null }))
Function listAllObjectVersions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async listAllObjectVersions({
filePath = undefined, bucketId = undefined, precisePath = true, filterLatest = false
} = {}) {
const key = filePath ?? (await utils.getBucket(bucketId)).key;
const path = key !== DELIMITER ? key : '';
Function create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
create: async (data, etrx = undefined) => {
let trx;
try {
trx = etrx ? etrx : await ObjectModel.startTransaction();
Function removePermissions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
removePermissions: async (bucketId, userIds = undefined, permissions = undefined, etrx = undefined) => {
if (!bucketId) {
throw new Error('Invalid bucketId supplied');
}
- 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 removePermissions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
removePermissions: async (objId, userIds = undefined, permissions = undefined, etrx = undefined) => {
if (!objId) {
throw new Error('Invalid objId supplied');
}
- 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 useInvite
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async useInvite(req, res, next) {
const token = addDashesToUuid(req.params.token);
try {
const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
- 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 readObject
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async readObject(req, res, next) {
try {
const objId = addDashesToUuid(req.params.objectId);
// target S3 version
- 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 _processS3Headers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_processS3Headers(s3Resp, res) {
// TODO: Consider adding 'x-coms-public' and 'x-coms-path' headers into API spec?
const exposedHeaders = [];
if (s3Resp.ContentLength) res.set('Content-Length', s3Resp.ContentLength);
- 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"