Showing 131 of 363 total issues
File object.js
has 793 lines of code (exceeds 250 allowed). Consider refactoring. Open
const Problem = require('api-problem');
const cors = require('cors');
const { v4: uuidv4, NIL: SYSTEM_USER } = require('uuid');
const {
Function syncVersions
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
syncVersions: async (object, userId = SYSTEM_USER, etrx = undefined) => {
let trx;
try {
trx = etrx ? etrx : await Version.startTransaction();
- 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 up
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.up = function (knex) {
return Promise.resolve()
// Create public schema COMS tables
.then(() => knex.schema.createTable('identity_provider', table => {
table.string('idp', 255).primary();
Function updateObject
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
async updateObject(req, res, next) {
try {
const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
// Preflight existence check for bucketId
Function createObject
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
async createObject(req, res, next) {
try {
const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
// Preflight CREATE permission check if bucket scoped and OIDC authenticated
Function syncVersions
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
syncVersions: async (object, userId = SYSTEM_USER, etrx = undefined) => {
let trx;
try {
trx = etrx ? etrx : await Version.startTransaction();
Function modifiers
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
static get modifiers() {
const Version = require('./version');
return {
filterIds(query, value) {
File sync.js
has 343 lines of code (exceeds 250 allowed). Consider refactoring. Open
const { NIL: SYSTEM_USER, v4: uuidv4, validate: uuidValidate } = require('uuid');
const log = require('../components/log')(module.filename);
const utils = require('../db/models/utils');
Function updateObject
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
async updateObject(req, res, next) {
try {
const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
// Preflight existence check for bucketId
- 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 currentUser
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
const currentUser = async (req, res, next) => {
const authorization = req.get('Authorization');
const currentUser = {
authType: AuthType.NONE
};
- 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 createInvite
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
async createInvite(req, res, next) {
let resource, type;
try {
// Reject if expiresAt is more than 30 days away
File storage.js
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
const {
CopyObjectCommand,
DeleteObjectCommand,
DeleteObjectTaggingCommand,
GetBucketEncryptionCommand,
Function createObject
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
async createObject(req, res, next) {
try {
const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
// Preflight CREATE permission check if bucket scoped and OIDC authenticated
- 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 24 (exceeds 5 allowed). Consider refactoring. Open
static get modifiers() {
const Version = require('./version');
return {
filterIds(query, value) {
- 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 createInvite
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
async createInvite(req, res, next) {
let resource, type;
try {
// Reject if expiresAt is more than 30 days away
- 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 syncTags
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
syncTags: async (version, path, bucketId = undefined, userId = SYSTEM_USER, etrx = undefined) => {
let trx;
try {
trx = etrx ? etrx : await Version.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
utils
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
const utils = {
/**
* @function addDashesToUuid
* Yields a lowercase uuid `str` that has dashes inserted, or `str` if not a string.
* @param {string} str The input string uuid
Function response
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
const response = await Promise.all(s3Versions.map(async s3Version => {
// S3 Object is in non-versioned bucket
if (s3Version.VersionId === 'null') {
const mimeType = await storageService.headObject({
filePath: comsObject.path,
Function syncObject
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
syncObject: async (path, bucketId, userId = SYSTEM_USER, etrx = undefined) => {
let trx;
try {
trx = etrx ? etrx : await ObjectModel.startTransaction();
- 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 currentUpload
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
const currentUpload = (strict = false) => {
return (req, _res, next) => {
// Check Content-Length Header
const contentLength = parseInt(req.get('Content-Length'));
// TODO: Figure out what's killing and returning a 400 in response stack
- 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"