makeomatic/ms-files

View on GitHub

Showing 128 of 128 total issues

Avoid deeply nested control flow statements.
Open

    } else if (actionTypeOrValue.eq) {
      query.push(`@${propName}:{ $f_${propName}_eq }`);
      params.push(`f_${propName}_eq`, actionTypeOrValue.eq);
    } else if (actionTypeOrValue.ne) {
      query.push(`-@${propName}:{ $f_${propName}_ne }`);
Severity: Major
Found in src/actions/list.js - About 45 mins to fix

    Function getDownloadURL has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    async function getDownloadURL({ params, headers: { headers } }) {
      const { uploadId, username, rename, types } = params;
    
      const key = `${FILES_DATA}:${uploadId}`;
    
    
    Severity: Minor
    Found in src/actions/download.js - About 45 mins to fix

    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 numericQueryRange has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const numericQueryRange = (actionTypeOrValue) => {
      // eslint-disable-next-line no-nested-ternary
      const lowerRange = actionTypeOrValue.gte || actionTypeOrValue.gt
        ? (
          actionTypeOrValue.gte
    Severity: Minor
    Found in src/actions/list.js - About 45 mins to fix

    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

    Avoid deeply nested control flow statements.
    Open

          if (numericProps.includes(propName)) {
            query.push(`-@${propName}:[-inf +inf]`);
          } else {
            query.push(`@${propName}:""`);
          }
    Severity: Major
    Found in src/actions/list.js - About 45 mins to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            if (ctx.nftOwner) {
              // only wallet match
              nftOwnerMatch = `(@${FILES_NFT_OWNER_FIELD}:{ $nftOwner }) @${FILES_HAS_NFT_OWNER_FIELD}:[1 1]`;
              params.push('nftOwner', ctx.nftOwner);
            }
      Severity: Minor
      Found in src/actions/list.js and 1 other location - About 40 mins to fix
      src/actions/list.js on lines 381..385

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 49.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            if (ctx.username) {
              // owner and empty wallet
              ownerMatch = `(@${FILES_OWNER_FIELD}:{ $username } -@${FILES_HAS_NFT_OWNER_FIELD}:[1 1])`;
              params.push('username', ctx.username);
            }
      Severity: Minor
      Found in src/actions/list.js and 1 other location - About 40 mins to fix
      src/actions/list.js on lines 387..391

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 49.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function getPlayerOpts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const getPlayerOpts = (id, { uploadType, c_ver: modelVersion, packed }, apiDomain) => {
        let version;
      
        // if upload type isn't simple - means we have old mesh upload
        // generally c_ver -> 1.x.x
      Severity: Minor
      Found in src/custom/cappasity-info-post.js - About 35 mins to fix

      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 uploadedIndexAt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      async function uploadedIndexAt(service) {
        const { redis, config, log } = service;
        const masterNode = getRedisMasterNode(redis, config);
      
        let iter = 0;
      Severity: Minor
      Found in src/migrations/uploaded-at-index/index.js - About 35 mins to fix

      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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          referenceInfoMap[refUploadId] = {
            hasNft,
            hasReferences,
            referenced,
            owner,
      Severity: Minor
      Found in src/utils/reference.js and 1 other location - About 35 mins to fix
      src/actions/list.js on lines 210..220

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 46.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        const {
          redis,
          criteria,
          order,
          strFilter,
      Severity: Minor
      Found in src/actions/list.js and 1 other location - About 35 mins to fix
      src/utils/reference.js on lines 59..69

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 46.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function removeFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      async function removeFile({ params }) {
        const { filename, username, softDelete } = params;
        const { redis, log } = this;
        const provider = this.provider('remove', params);
        const key = `${FILES_DATA}:${filename}`;
      Severity: Minor
      Found in src/actions/remove.js - About 25 mins to fix

      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 nameToNameNormalized has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      async function nameToNameNormalized(service) {
        const { redis: masterNode, log } = service;
        let iter = 0;
      
        const stream = masterNode.sscanStream(FILES_INDEX, {
      Severity: Minor
      Found in src/migrations/name-to-name-normalized/index.js - About 25 mins to fix

      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 preProcessMetadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function preProcessMetadata(data) {
        const { description, alias } = data;
      
        // Trim extra spaces in case of typo
        if (description != null && typeof description === 'string') {
      Severity: Minor
      Found in src/actions/update.js - About 25 mins to fix

      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

      Parsing error: The keyword 'const' is reserved
      Open

      const processRegExp = /\.process$/;
      Severity: Minor
      Found in src/configs/router-amqp.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Parsing error: The keyword 'const' is reserved
      Open

      const fs = require('fs');
      Severity: Minor
      Found in src/migrations/cleanup-pub/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Parsing error: The keyword 'const' is reserved
      Open

      const { ValidationError } = require('common-errors');
      Severity: Minor
      Found in src/utils/reference.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Parsing error: The keyword 'const' is reserved
      Open

      const { ActionTransport } = require('@microfleet/plugin-router');
      Severity: Minor
      Found in src/actions/info.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Parsing error: The keyword 'const' is reserved
      Open

      const { ActionTransport } = require('@microfleet/plugin-router');
      Severity: Minor
      Found in src/actions/list.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Parsing error: The keyword 'const' is reserved
      Open

      const { ActionTransport } = require('@microfleet/plugin-router');
      Severity: Minor
      Found in src/actions/sync.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Definition for rule 'no-constant-binary-expression' was not found
      Open

      exports.migrations = {
      Severity: Minor
      Found in src/configs/migrations.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Severity
      Category
      Status
      Source
      Language