Showing 128 of 128 total issues
Function redisSearch
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
async function redisSearch(ctx) {
// 1. build query
const indexName = `${ctx.service.config.redis.options.keyPrefix}:${FILES_LIST_SEARCH}`;
const args = ['FT.SEARCH', indexName];
const query = [];
- 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
File list.js
has 489 lines of code (exceeds 250 allowed). Consider refactoring. Open
const { ActionTransport } = require('@microfleet/plugin-router');
const Promise = require('bluebird');
const fsort = require('redis-filtered-sort');
const perf = require('ms-perf');
const { HttpStatusError, NotImplementedError } = require('common-errors');
Function updateMeta
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
async function updateMeta(lock, ctx, params) {
const { uploadId, username, directOnly, immutable, includeReferences } = params;
const { redis } = ctx;
const key = FILES_DATA_INDEX_KEY(uploadId);
const meta = preProcessMetadata(params.meta);
- 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 redisSearch
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function redisSearch(ctx) {
// 1. build query
const indexName = `${ctx.service.config.redis.options.keyPrefix}:${FILES_LIST_SEARCH}`;
const args = ['FT.SEARCH', indexName];
const query = [];
Function updateMeta
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function updateMeta(lock, ctx, params) {
const { uploadId, username, directOnly, immutable, includeReferences } = params;
const { redis } = ctx;
const key = FILES_DATA_INDEX_KEY(uploadId);
const meta = preProcessMetadata(params.meta);
Function interstore
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
async function interstore(ctx) {
const { isPublic, temp, tags, redis, hasTags, uploadedAt, order, maxInterval, username, modelType } = ctx;
if (modelType === 'nft') {
throw new NotImplementedError('nft filter is unavailable');
- 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 interstore
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function interstore(ctx) {
const { isPublic, temp, tags, redis, hasTags, uploadedAt, order, maxInterval, username, modelType } = ctx;
if (modelType === 'nft') {
throw new NotImplementedError('nft filter is unavailable');
Function initFileUpload
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
async function initFileUpload({ params }) {
const {
meta,
username,
temp,
- 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
File cappasity-info-post.js
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
// 1. для мешей старый вариант
// 2. для всех 3д вью - ротэйт опции
// 3. если 3двью имеет версию 4+ - добавляются зум опции
const flatstr = require('flatstr');
Function extractMetadata
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function extractMetadata(params) {
let sourceSHA;
const {
files,
- 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 completeFileUpload
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
async function completeFileUpload({ params }) {
const { filename } = params;
const { redis, config, amqp, provider } = this;
const { prefix } = config.router.routes;
const uploadPartKey = `${UPLOAD_DATA}:${filename}`;
- 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
File gce.js
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
const Promise = require('bluebird');
const AbstractFileTransfer = require('ms-files-transport');
const { get, merge, defaults } = require('lodash');
const bl = require('bl');
const assert = require('assert');
GCETransport
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class GCETransport extends AbstractFileTransfer {
constructor(opts = {}) {
super();
this._config = merge({}, GCETransport.defaultOpts, opts);
this._logger = this._config.logger;
Function cloneFile
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function cloneFile(lock, ctx, params) {
const { uploadId, username, meta } = params;
const { redis } = ctx;
const uploadKey = FILES_DATA_INDEX_KEY(uploadId);
const uploadData = await Promise
Function extractMetadata
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function extractMetadata(params) {
let sourceSHA;
const {
files,
Function performProcessing
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
const performProcessing = async (lock, service, data) => {
const { uploadId } = data;
const { redis } = service;
let response;
Function verifyReferences
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function verifyReferences(originalMeta, referenceInfoMap, newReferences) {
const { uploadId, owner } = originalMeta;
const oldReferences = originalMeta[FILES_REFERENCES_FIELD] || [];
const added = findAdded(oldReferences, newReferences);
Function postProcessFile
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
async function postProcessFile({ params }) {
const { uploadId, username, awaitPostActions } = params;
const { maxTries } = this.config;
const key = `${FILES_DATA}:${uploadId}`;
- 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 verifyUploadData
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
.try(function verifyUploadData() {
if (uploadType === 'simple' && files.find(isPack)) {
meta[FILES_PACKED_FIELD] = '1';
return null;
}
Function getReferenceData
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getReferenceData(redis, references = []) {
const pipeline = redis.pipeline();
references.forEach((id) => {
pipeline.smembers(FILES_REFERENCED_INDEX_KEY(id));