wmakeev/moysklad

View on GitHub

Showing 537 of 537 total issues

Function buildQuery has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function buildQuery(query) {
  // совместимость с remap 1.2
  if (query.expand && query.limit == null) {
    query.limit = 100
  }
Severity: Minor
Found in src/tools/buildQuery.js - About 1 hr to fix

    Function 706 has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    "use strict";
    
    
    
    Severity: Minor
    Found in bundle/umd/moysklad.js - About 1 hr to fix

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

        'Moysklad.Collection': col =>
          !!(
            col &&
            col.meta &&
            col.meta.type &&
      Severity: Major
      Found in src/matchers.js and 1 other location - About 1 hr to fix
      bundle/umd/moysklad.js on lines 748..755

      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 64.

      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

        'Moysklad.Collection': col =>
          !!(
            col &&
            col.meta &&
            col.meta.type &&
      Severity: Major
      Found in bundle/umd/moysklad.js and 1 other location - About 1 hr to fix
      src/matchers.js on lines 26..33

      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 64.

      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

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

      function extractQueryValues(str) {
        return str.indexOf(',') !== -1
          ? str.split(',').map(v => extractQueryValue(v))
          : [extractQueryValue(str)]
      }
      Severity: Major
      Found in src/tools/parseQueryString.js and 1 other location - About 1 hr to fix
      bundle/umd/moysklad.js on lines 1672..1676

      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 62.

      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

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

      function extractQueryValues(str) {
        return str.indexOf(',') !== -1
          ? str.split(',').map(v => extractQueryValue(v))
          : [extractQueryValue(str)]
      }
      Severity: Major
      Found in bundle/umd/moysklad.js and 1 other location - About 1 hr to fix
      src/tools/parseQueryString.js on lines 20..24

      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 62.

      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 buildUrl has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function buildUrl(...args) {
        // eslint-disable-next-line prefer-const
        let { url, path, query } = have.strict(args, [
          { url: 'url', query: 'opt Object' },
          { path: 'str or str arr', query: 'opt Object' },
      Severity: Minor
      Found in src/methods/buildUrl.js - About 1 hr to fix

        Function buildUrl has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function buildUrl(...args) {
          // eslint-disable-next-line prefer-const
          let { url, path, query } = have.strict(args, [
            { url: 'url', query: 'opt Object' },
            { path: 'str or str arr', query: 'opt Object' },
        Severity: Minor
        Found in bundle/umd/moysklad.js - About 1 hr to fix

          Function exports has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = (function () {
            var assert = customAssert
          
            function have (args, schema, strict) {
              var res = ensureArgs(args, schema, this.matchers, strict)
          Severity: Minor
          Found in bundle/umd/moysklad.js - About 1 hr to fix

            Function getAuthHeader has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function getAuthHeader() {
              let token
              let login
              let password
            
            
            Severity: Minor
            Found in src/methods/getAuthHeader.js - About 1 hr to fix

              Function getAuthHeader has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function getAuthHeader() {
                let token
                let login
                let password
              
              
              Severity: Minor
              Found in bundle/umd/moysklad.js - About 1 hr to fix

                Function showErrors has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                async function showErrors() {
                  //#region (1) MoyskladError
                  try {
                    await ms.GET('entity/product', {
                      filter: 123
                Severity: Minor
                Found in examples/errors.js - About 1 hr 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 9 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
                
                "use strict";
                
                
                
                Severity: Minor
                Found in bundle/umd/moysklad.js - About 1 hr to fix

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

                      await ms.POST('entity/product', [
                        { foo: 'bar' },
                        {
                          meta: {
                            type: 'product',
                  Severity: Major
                  Found in examples/errors.js and 1 other location - About 1 hr to fix
                  examples/errors.js on lines 116..126

                  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 56.

                  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

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

                      [
                        { foo: 'bar' },
                        {
                          meta: {
                            type: 'product',
                  Severity: Major
                  Found in examples/errors.js and 1 other location - About 1 hr to fix
                  examples/errors.js on lines 97..107

                  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 56.

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

                  module.exports = function parseUrl(...args) {
                    const { url, path } = have.strict(args, [
                      { url: 'url' },
                      { path: 'str or str arr' }
                    ])
                  Severity: Minor
                  Found in src/methods/parseUrl.js - About 55 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 getResponseError has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = function getResponseError(responseBody, response) {
                    if (!responseBody) return null
                  
                    if (Array.isArray(responseBody)) {
                      const errorsIndexes = responseBody
                  Severity: Minor
                  Found in src/getResponseError.js - About 55 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

                    'entity': ent =>
                      !!(ent && ent.id && uuidMatcher(ent.id) && ent.meta && ent.meta.type),
                  Severity: Minor
                  Found in src/matchers.js and 1 other location - About 55 mins to fix
                  bundle/umd/moysklad.js on lines 735..736

                  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 53.

                  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

                    'entity': ent =>
                      !!(ent && ent.id && uuidMatcher(ent.id) && ent.meta && ent.meta.type),
                  Severity: Minor
                  Found in bundle/umd/moysklad.js and 1 other location - About 55 mins to fix
                  src/matchers.js on lines 13..14

                  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 53.

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

                  module.exports = function parseQueryString(queryString) {
                    if (queryString == null || queryString === '') {
                      return undefined
                    }
                    queryString = queryString.trim()
                  Severity: Minor
                  Found in src/tools/parseQueryString.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

                  Severity
                  Category
                  Status
                  Source
                  Language