feathersjs-offline/owndata-ownnet

View on GitHub
packages/client/src/own-common/own-class.js

Summary

Maintainability
A
0 mins
Test Coverage
A
97%

File own-class.js has 570 lines of code (exceeds 300 allowed). Consider refactoring.
Wontfix

import EventEmitter from 'component-emitter';
import sift from 'sift';
import { sorter, select, AdapterService } from '@feathersjs/adapter-commons';
import { _, hooks, stripSlashes } from '@feathersjs/commons';
import errors from '@feathersjs/errors';
Severity: Major
Found in packages/client/src/own-common/own-class.js - About 1 day to fix

    OwnClass has 34 functions (exceeds 30 allowed). Consider refactoring.
    Wontfix

    class OwnClass extends AdapterService {
      constructor (opts) {
        const newOpts = Object.assign({}, defaultOptions, opts);
    
        debug(`Constructor started, newOpts = ${JSON.stringify(newOpts)}`);
    Severity: Minor
    Found in packages/client/src/own-common/own-class.js - About 2 hrs to fix

      Function setup has a Cognitive Complexity of 17 (exceeds 6 allowed). Consider refactoring.
      Wontfix

        async setup (app, path) {
          debug(`SetUp('${path}') started`);
          if (this._setupPerformed) { // Assure we only run setup once
            return;
          }
      Severity: Minor
      Found in packages/client/src/own-common/own-class.js - About 2 hrs 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 _create has a Cognitive Complexity of 10 (exceeds 6 allowed). Consider refactoring.
      Wontfix

        async _create (data, params, ts = 0) {
          debug(`Calling _create(${JSON.stringify(data)}, ${JSON.stringify(params)}, ${ts})`);
          let self = this;
          if (Array.isArray(data)) {
            const multi = this.allowsMulti('create');
      Severity: Minor
      Found in packages/client/src/own-common/own-class.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 _patch has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring.
      Wontfix

        async _patch (id, data, params = {}, ts = 0) {
          debug(`Calling _patch(${id}, ${JSON.stringify(data)}, ${JSON.stringify(params)}})`);
          let self = this;
          if (id === null) {
            const multi = this.allowsMulti('patch');
      Severity: Minor
      Found in packages/client/src/own-common/own-class.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 sync has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring.
      Wontfix

        async sync (bAll = false) {
          while (!this.internalProcessingAllowed()) {
            // console.log(`sync: await internalProcessing (aIP=${this.aIP})`);
            await new Promise(resolve => {
              setTimeout(() => {
      Severity: Minor
      Found in packages/client/src/own-common/own-class.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 5 locations. Consider refactoring.
      Wontfix

          return Promise.resolve(newData)
            .then(this._strip)
            .then(this._select(params))
            .then(stringsToDates(this._dates));
      Severity: Major
      Found in packages/client/src/own-common/own-class.js and 4 other locations - About 45 mins to fix
      packages/client/src/own-common/own-class.js on lines 256..259
      packages/client/src/own-common/own-class.js on lines 370..373
      packages/client/src/own-common/own-class.js on lines 527..530
      packages/client/src/own-common/own-class.js on lines 617..620

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

      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 5 locations. Consider refactoring.
      Wontfix

          return Promise.resolve(newData)
            .then(this._strip)
            .then(this._select(params))
            .then(stringsToDates(this._dates));
      Severity: Major
      Found in packages/client/src/own-common/own-class.js and 4 other locations - About 45 mins to fix
      packages/client/src/own-common/own-class.js on lines 256..259
      packages/client/src/own-common/own-class.js on lines 370..373
      packages/client/src/own-common/own-class.js on lines 445..448
      packages/client/src/own-common/own-class.js on lines 617..620

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

      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 5 locations. Consider refactoring.
      Wontfix

          return Promise.resolve(res)
            .then(this._strip)
            .then(this._select(params))
            .then(stringsToDates(this._dates));
      Severity: Major
      Found in packages/client/src/own-common/own-class.js and 4 other locations - About 45 mins to fix
      packages/client/src/own-common/own-class.js on lines 256..259
      packages/client/src/own-common/own-class.js on lines 445..448
      packages/client/src/own-common/own-class.js on lines 527..530
      packages/client/src/own-common/own-class.js on lines 617..620

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

      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 5 locations. Consider refactoring.
      Wontfix

          return Promise.resolve(res)
            .then(this._strip)
            .then(this._select(params))
            .then(stringsToDates(this._dates));
      Severity: Major
      Found in packages/client/src/own-common/own-class.js and 4 other locations - About 45 mins to fix
      packages/client/src/own-common/own-class.js on lines 370..373
      packages/client/src/own-common/own-class.js on lines 445..448
      packages/client/src/own-common/own-class.js on lines 527..530
      packages/client/src/own-common/own-class.js on lines 617..620

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

      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 5 locations. Consider refactoring.
      Wontfix

          return Promise.resolve(beforeRecord)
            .then(this._strip)
            .then(this._select(params))
            .then(stringsToDates(this._dates));
      Severity: Major
      Found in packages/client/src/own-common/own-class.js and 4 other locations - About 45 mins to fix
      packages/client/src/own-common/own-class.js on lines 256..259
      packages/client/src/own-common/own-class.js on lines 370..373
      packages/client/src/own-common/own-class.js on lines 445..448
      packages/client/src/own-common/own-class.js on lines 527..530

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

      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

      There are no issues that match your filters.

      Category
      Status