Katochimoto/xblocks

View on GitHub

Showing 58 of 58 total issues

Function default has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export default function (event) {
    if (event.hasOwnProperty(ConstantEvent.WRAP)) {
        return event;
    }

Severity: Minor
Found in src/event/wrap.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

File TableNavigator.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import _ from 'lodash';
import { event as xevent } from 'xblocks-core';
import delegate from 'event/delegate';
import filterClick from 'event/filterClick';
import filterMouse from 'event/filterMouse';
Severity: Minor
Found in src/utils/TableNavigator.js - About 2 hrs to fix

    Function default has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function (node, callback, context, inner) {
        inner = (typeof inner === 'undefined' ? true : Boolean(inner));
        var prev;
        var cbcall;
    
    
    Severity: Minor
    Found in src/dom/eachBefore.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 default has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function (node, callback, context, inner) {
        inner = (typeof inner === 'undefined' ? true : Boolean(inner));
        var next;
        var cbcall;
    
    
    Severity: Minor
    Found in src/dom/eachAfter.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 menuitemSelect has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            menuitemSelect: function () {
                if (!this.selectable) {
                    return;
                }
    
    
    Severity: Minor
    Found in src/mixin/element/menu.js - About 1 hr to fix

      Function default has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function (node, callback) {
          var stack = [ node ];
          var item;
          var cbcall;
          var childsLength;
      Severity: Minor
      Found in src/dom/eachInnerFollowing.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 default has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function (node, callback) {
          var stack = [ node ];
          var item;
          var cbcall;
          var i;
      Severity: Minor
      Found in src/dom/eachInnerPrevious.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 default has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function (event) {
          if (event.hasOwnProperty(ConstantEvent.WRAP)) {
              return event;
          }
      
      
      Severity: Minor
      Found in src/event/wrap.js - About 1 hr to fix

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

                render: function () {
                    const classes = classnames({
                        [ tagName ]: true
                    });
        
        
        Severity: Minor
        Found in src/mixin/view/menu.js - About 1 hr to fix

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

                  render: function () {
                      const classes = classnames({
                          'xb-checkbox': true,
                          '_disabled': this.props.disabled,
                          [ `_size-${this.props.size}` ]: true
          Severity: Minor
          Found in src/blocks/checkbox/index.jsx - About 1 hr to fix

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

                    render: function () {
                        const classes = classnames({
                            'xb-menuitem': true,
                            '_disabled':   this.props.disabled,
                            '_focused':    this.props.focused,
            Severity: Minor
            Found in src/blocks/menuitem/index.jsx - About 1 hr to fix

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

                      render: function () {
                          const classes = classnames({
                              'xb-radio':  true,
                              '_disabled': this.props.disabled,
                              [ `_size-${this.props.size}` ]: true
              Severity: Minor
              Found in src/blocks/radio/index.jsx - About 1 hr to fix

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

                function fillOptionsFromAttrs(popupOptions, attrs) {
                    for (let attrName in attrs) {
                        let params = ATTRS_ALIGN[ attrName ];
                        if (!params) {
                            continue;
                Severity: Minor
                Found in src/blocks/popup/index.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

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

                        accessors: {
                            componentStyle: {
                                get: function () {
                                    return {
                                        [ this.xtagName ]: require('!!raw!postcss!stylus!./style/inline.styl')
                Severity: Major
                Found in src/blocks/menu-inline/index.js and 1 other location - About 1 hr to fix
                src/blocks/link/index.js on lines 28..40

                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

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

                        accessors: {
                            componentStyle: {
                                get: function () {
                                    return {
                                        [ this.xtagName ]: require('!!raw!postcss!stylus!./style/inline.styl')
                Severity: Major
                Found in src/blocks/link/index.js and 1 other location - About 1 hr to fix
                src/blocks/menu-inline/index.js on lines 56..68

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

                    render: function () {
                        const classes = classnames({
                            '_content': true,
                            '_empty': this.context.isEmptyContent()
                        });
                Severity: Minor
                Found in src/blocks/button/content.jsx - About 1 hr to fix

                  Function xb-speech-recognition-result has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              'xb-speech-recognition-result': function (event) {
                                  if (event.detail) {
                                      var input = this.querySelector('input');
                  
                                      if (event.detail.interim) {
                  Severity: Minor
                  Found in src/blocks/input/index.js - About 1 hr to fix

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

                        _rowPrev(row) {
                            var data = {};
                            eachBefore(row, this._rowMatchIterate.bind(this, data), this._col(row), false);
                            return data.row;
                        }
                    Severity: Major
                    Found in src/utils/TableNavigator.js and 1 other location - About 1 hr to fix
                    src/utils/TableNavigator.js on lines 132..136

                    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 2 locations. Consider refactoring.
                    Open

                    const MENU_ATTRS = {
                        'attachment': 'top left',
                        'target-attachment': 'bottom left',
                        'target-modifier': 'initial',
                        'constraints': encodeURIComponent(JSON.stringify([
                    Severity: Major
                    Found in src/blocks/select/index.js and 1 other location - About 1 hr to fix
                    src/blocks/menuitem/index.js on lines 16..26

                    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 2 locations. Consider refactoring.
                    Open

                        _rowNext(row) {
                            var data = {};
                            eachAfter(row, this._rowMatchIterate.bind(this, data), this._col(row), false);
                            return data.row;
                        }
                    Severity: Major
                    Found in src/utils/TableNavigator.js and 1 other location - About 1 hr to fix
                    src/utils/TableNavigator.js on lines 138..142

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language