Semantic-Org/Semantic-UI-Ember

View on GitHub

Showing 29 of 29 total issues

Function _areSelectedEqual has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  _areSelectedEqual(selectedValue, moduleValue, isMultiple) {
    if (isMultiple) {
      // If selectedValue passed in is an array, we are assuming that its the collection getting updated and that
      // all module values must equal the attrValues

Severity: Minor
Found in addon/components/ui-dropdown.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

BaseMixin has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

Semantic.BaseMixin = Ember.Mixin.create({
  /// Internal Variables
  _initialized: false,
  _bindableAttrs: null,
  _settableAttrs: null,
Severity: Minor
Found in addon/mixins/base.js - About 2 hrs to fix

    Function _settings has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      _settings() {
        let moduleName = this.getSemanticModuleName();
    
        let moduleGlobal = this.getSemanticModuleGlobal();
        if (!moduleGlobal) {
    Severity: Minor
    Found in addon/mixins/base.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 exports has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function(path, property, options) {
      for (var i = 0; i < options.length; i++) {
        var option = options[i];
        if (option == null || typeof option !== "object") {
          continue;
    Severity: Minor
    Found in lib/utils/get-default.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 included has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      included: function (app) {
        // If the addon has the _findHost() method (in ember-cli >= 2.7.0), we'll just
        // use that. This helps support ember-engines, where we want to find 
        // the 'parent' app
        if (typeof this._findHost === 'function') {
    Severity: Minor
    Found in index.js - About 1 hr to fix

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

            if (isPromise(value)) {
              if (!isFulfilled(value)) {
                return this.resolvePromise(Ember.RSVP.hash({ value, current }), this._checkValueAndCurrent);
              } else {
                value = getPromiseContent(value);
      Severity: Major
      Found in addon/components/ui-radio.js and 1 other location - About 1 hr to fix
      addon/components/ui-radio.js on lines 58..64

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

      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

            if (isPromise(current)) {
              if (!isFulfilled(current)) {
                return this.resolvePromise(Ember.RSVP.hash({ value, current }), this._checkValueAndCurrent);
              } else {
                current = getPromiseContent(current);
      Severity: Major
      Found in addon/components/ui-radio.js and 1 other location - About 1 hr to fix
      addon/components/ui-radio.js on lines 50..56

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

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

        _inspectValueAndCurrent() {
          let value = this.get('value');
          let current = this.get('current');
          // If either are a promise, we need to make sure both are resolved
          // Or wait for them to resolve
      Severity: Minor
      Found in addon/components/ui-radio.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

            for (let i = 0; i < Ember.get(values, 'length'); i++) {
              let item = this._atIndex(values, i);
              returnValue.push(this._getObjectOrValue(item));
            }
      Severity: Major
      Found in addon/components/ui-dropdown.js and 1 other location - About 1 hr to fix
      addon/components/ui-dropdown.js on lines 159..162

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

      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

            for (let i = 0; i < Ember.get(selectedValue, 'length'); i++) {
              let item = this._atIndex(selectedValue, i);
              keys.push(this._getObjectKeyByValue(item));
            }
      Severity: Major
      Found in addon/components/ui-dropdown.js and 1 other location - About 1 hr to fix
      addon/components/ui-dropdown.js on lines 82..85

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

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

        included: function (app) {
          // If the addon has the _findHost() method (in ember-cli >= 2.7.0), we'll just
          // use that. This helps support ember-engines, where we want to find 
          // the 'parent' app
          if (typeof this._findHost === 'function') {
      Severity: Minor
      Found in 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

      Function setSemanticAttr has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        setSemanticAttr(attrName, attrValue) {
          if (attrName === 'content' || attrName === 'title' || attrName === 'html') {
            let value = this._unwrapHTMLSafe(attrValue);
            let response = this.execute('setting', attrName, value);
            if (this.execute('is visible')) {
      Severity: Minor
      Found in addon/components/ui-popup.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 _areSelectedEqual has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _areSelectedEqual(selectedValue, moduleValue, isMultiple) {
          if (isMultiple) {
            // If selectedValue passed in is an array, we are assuming that its the collection getting updated and that
            // all module values must equal the attrValues
      
      
      Severity: Minor
      Found in addon/components/ui-dropdown.js - About 1 hr to fix

        Function _settings has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _settings() {
            let moduleName = this.getSemanticModuleName();
        
            let moduleGlobal = this.getSemanticModuleGlobal();
            if (!moduleGlobal) {
        Severity: Minor
        Found in addon/mixins/base.js - About 1 hr to fix

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

          test('use new location of imports', function (assert) {
            assert.plan(1);
            assert.equal(getDefault('imports', 'fonts', [{'imports': {'fonts': false}}, defaults()]), false);
          });
          Severity: Major
          Found in tape-tests/utils/get-default-test.js and 1 other location - About 1 hr to fix
          tape-tests/utils/get-default-test.js on lines 63..66

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

          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

          test('use new location of imports if undefined in user options', function (assert) {
            assert.plan(1);
            assert.equal(getDefault('imports', 'javascript', [{'imports': {'fonts': false}}, defaults()]), true);
          });
          Severity: Major
          Found in tape-tests/utils/get-default-test.js and 1 other location - About 1 hr to fix
          tape-tests/utils/get-default-test.js on lines 58..61

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

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

            setSemanticAttr(attrName, attrValue) {
              if (attrName === 'content' || attrName === 'title' || attrName === 'html') {
                let value = this._unwrapHTMLSafe(attrValue);
                let response = this.execute('setting', attrName, value);
                if (this.execute('is visible')) {
          Severity: Minor
          Found in addon/components/ui-popup.js - About 1 hr to fix

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

              setSemanticAttr(attrName, attrValue) {
                // Handle checked
                if (attrName === 'checked') {
                  if (attrValue) {
                    return this.execute('set checked');
            Severity: Minor
            Found in addon/mixins/checkbox.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 _setCurrentSelected has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              _setCurrentSelected(selectedValue, moduleSelected, isMultiple) {
                if (Ember.isBlank(selectedValue)) {
                  if (!Ember.isBlank(moduleSelected)) {
                    this.execute('clear');
                  }
            Severity: Minor
            Found in addon/components/ui-dropdown.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

            Avoid deeply nested control flow statements.
            Open

                      if (this.areAttrValuesEqual('selected', selectedValue, item)) {
                        return true; // We found a match, just looking for one
                      }
            Severity: Major
            Found in addon/components/ui-dropdown.js - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language