busy-web/components

View on GitHub

Showing 18 of 21 total issues

Function checkPosition has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    checkPosition() {
        const elem = this.$().offsetParent();

        let menuHeightTop = elem.height() - (elem.height() - (this.$().offset().top - elem.offset().top)) - 20; // height of the container minus the the bottom space from the top of the button.
        let menuHeightBot = elem.height() - ((this.$().offset().top + this.$().height()) - elem.offset().top) - 20; // height of the container minus the bottom of the select button.
Severity: Minor
Found in addon/components/bc-select.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 didRender has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    didRender() {
        this._super();

        if (!get(this, 'firstRender')) {
            set(this, 'firstRender', true);
Severity: Minor
Found in addon/components/bc-tabs.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 openTab has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    openTab(tab) {
        if (this.$().length > 0) {
            // hide all other tabs
            get(this, 'model').forEach(item => item.hideTab());

Severity: Minor
Found in addon/components/bc-tabs.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 sortableObject has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export default function sortableObject(meta) {
    // get header if it was provided
    let header = get(meta, 'header');
    if (isNone(header)) {
        header = '';
Severity: Minor
Found in addon/utils/sortable-object.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 typeCast has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function typeCast(value) {
    if (/^[.][\d]+/.test(value)) {
        return typeCast(0 + value);
    }

Severity: Minor
Found in addon/utils/parse.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 buildTabData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    buildTabData() {
        assert('buildTabData must be called after render', this.$().length > 0);

        let model = [];
        this.$(TAB_CONTENT).children().each((index, el) => {
Severity: Minor
Found in addon/components/bc-tabs.js - About 1 hr to fix

    Function sortableObject has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function sortableObject(meta) {
        // get header if it was provided
        let header = get(meta, 'header');
        if (isNone(header)) {
            header = '';
    Severity: Minor
    Found in addon/utils/sortable-object.js - About 1 hr to fix

      Function renderTemplates has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          renderTemplates: function() {
              const list = this.$();
              if (list && list.find) {
                  const row = list.find('section').children('.content-row').first();
                  if (row.length > 0) {
      Severity: Minor
      Found in addon/components/bc-list.js - About 1 hr to fix

        Function createModelContainer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        function createModelContainer(target, model, metaData) {
            assert('model is required for createModelContainer', !isNone(model) && typeof model === 'object');
            assert('metaData is required for createModelContainer', !isEmpty(metaData) && Array.isArray(metaData));
        
            // create container
        Severity: Minor
        Found in addon/components/bc-sortable-list.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

        Avoid deeply nested control flow statements.
        Open

                                        if (get(oldOpt, key) !== get(option, key)) {
                                            hasChanges = true;
                                        }
        Severity: Major
        Found in addon/components/bc-select-menu.js - About 45 mins to fix

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

              open() {
                  if (!get(this, 'isDestroyed')) {
                      this.bindEscape();
                      this.bindClick();
          
          
          Severity: Minor
          Found in addon/components/bc-select.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 setListener has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function setListener(type, namespace, listener, capture=false, passive=false) {
          Severity: Minor
          Found in addon/utils/event.js - About 35 mins to fix

            Function bind has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            export function bind(target, type, namespace, listener, { capture=false, rebind=false, passive=false, once=false }) {
            Severity: Minor
            Found in addon/utils/event.js - About 35 mins to fix

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

              function addQueryStringPair(params, key, value) {
                  if (/\[.+\]/.test(key)) { // parse type: `key[subkey]=value`
                      let [ normalizeKey, subKey ] = key.split('[');
                      subKey = subKey.split(']').join('');
                      let obj = get(params, normalizeKey) || {};
              Severity: Minor
              Found in addon/utils/parse.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

              Avoid too many return statements within this function.
              Open

                              return val;
              Severity: Major
              Found in addon/utils/parse.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return value;
                Severity: Major
                Found in addon/utils/parse.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return val;
                  Severity: Major
                  Found in addon/utils/parse.js - About 30 mins to fix

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

                        click(evt) {
                            if (!get(this, 'disabled')) {
                                if (!get(this, 'bubbles')) {
                                    evt.stopPropagation();
                                }
                    Severity: Minor
                    Found in addon/components/md-button.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