busy-web/utils

View on GitHub

Showing 10 of 20 total issues

File currency-codes.js has 1459 lines of code (exceeds 250 allowed). Consider refactoring.
Open


import EmberObject from '@ember/object';
import { A } from '@ember/array';

/***/
Severity: Major
Found in addon/utils/currency-codes.js - About 3 days to fix

    Function convertSecondsString has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        convertSecondsString(seconds, format, padHours=false, showSeconds=false, longFormat=false, toFixed=2) {
            let timeStr = '';
    
            // format can be passed in to override the users ability to change
            // the format.
    Severity: Minor
    Found in addon/time.js - About 4 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 setup has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        setup() {
            let lastId = null;
            let lastDesc = null;
            this.comments.forEach(line => {
                line.replace(/^(@([^ ]*)( ([^\{][^ ]*))?( \{([^\}]*)?\})?)?([\s\S]*)$/, (...args) => {
    Severity: Minor
    Found in lib/helpers/defined-property.js - About 1 hr to fix

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

          convertSecondsString(seconds, format, padHours=false, showSeconds=false, longFormat=false, toFixed=2) {
              let timeStr = '';
      
              // format can be passed in to override the users ability to change
              // the format.
      Severity: Minor
      Found in addon/time.js - About 1 hr to fix

        Function _printMethods has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _printMethods(arr) {
                arr.forEach(item => {
                    this.writeBlocks(2,
                        chalk.green(item.getProperty('method').name),
                        chalk.yellow(item.getProperty('returns').type),
        Severity: Minor
        Found in lib/helpers/logger.js - About 1 hr to fix

          Function _printProps has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _printProps(arr) {
                  arr.forEach(item => {
                      const optional = item.isOptional ? 'optional' : '';
                      const required = item.isRequired ? 'required' : '';
                      const readOnly = item.isReadOnly ? 'readonly' : '';
          Severity: Minor
          Found in lib/helpers/logger.js - About 1 hr to fix

            Function convertSecondsString has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                convertSecondsString(seconds, format, padHours=false, showSeconds=false, longFormat=false, toFixed=2) {
            Severity: Minor
            Found in addon/time.js - About 45 mins to fix

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

                  type() {
                      assert.funcNumArgs(arguments, 0, true);
              
                      let name = window.navigator.userAgent;
                      if (this.isBrowserType("Opera")) { // Opera
              Severity: Minor
              Found in addon/browser.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 osType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  osType() {
                      assert.funcNumArgs(arguments, 0, true);
              
                      let osType = "Unknown OS";
                      if (window.navigator.appVersion.indexOf("Win") !== -1) { // windows os
              Severity: Minor
              Found in addon/browser.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 _class has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  _class() {
                      const _class = this.find(this.docs, 'class');
                      if (!isNone(_class)) {
                          const val = _class.getProperty('class');
                          const classString = val.desc.shift();
              Severity: Minor
              Found in lib/helpers/logger.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

              Severity
              Category
              Status
              Source
              Language