capejs/capejs

View on GitHub

Showing 41 of 65 total issues

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

module.exports = function(config) {
  config.set({
    basePath: '',
    autoWatch: true,
    frameworks: ['mocha'],
Severity: Minor
Found in test/karma.conf.js - About 1 hr to fix

    Function deepExtend has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    Cape.deepExtend = function() {
      let i, key
    
      for (i = 1; i < arguments.length; i++)
        for (key in arguments[i])
    Severity: Minor
    Found in lib/cape/utilities.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 stubFetchAPI has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function stubFetchAPI(spy, data, dataType) {
      data = data || '{}';
    
      var response = { status: 200 };
      if (dataType) {
    Severity: Minor
    Found in test/helpers.js - About 1 hr to fix

      Function ajax has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        ajax: function(httpMethod, path, params, callback, errorHandler) {
          params = params || {}
          errorHandler = errorHandler || this.defaultErrorHandler
      
          this._.applyAdapter()
      Severity: Minor
      Found in lib/cape/mixins/agent_common_methods.js - About 1 hr to fix

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

          checkedOn(name) {
            let names, formName, attrName, forms, elements, cb, value
        
            names = this._.getNames(name)
            formName = names[0]
        Severity: Minor
        Found in lib/cape/virtual_forms.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 (elem.name.slice(-2) === '[]') {
                      if (!Array.isArray(obj[elem.name])) obj[elem.name] = []
                      if (elem.checked) obj[elem.name].push(elem.value)
                    }
                    else {
        Severity: Major
        Found in lib/cape/virtual_forms.js - About 45 mins to fix

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

            ajax: function(httpMethod, path, params, callback, errorHandler) {
              params = params || {}
              errorHandler = errorHandler || this.defaultErrorHandler
          
              this._.applyAdapter()
          Severity: Minor
          Found in lib/cape/mixins/agent_common_methods.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

                      for (k = 0; k < tForm[elemName].length; k++) {
                        if (elem.value === tForm[elemName][k]) {
                          elem.checked = true
                          break
                        }
          Severity: Major
          Found in lib/cape/virtual_forms.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if (elem.value !== tForm[elemName])
                        elem.value = tForm[elemName] ? tForm[elemName] : ''
            Severity: Major
            Found in lib/cape/virtual_forms.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        else if (elem.type === 'radio') {
                          if (elem.checked) obj[elem.name] = elem.value
                        }
                        else {
                          obj[elem.name] = elem.value
              Severity: Major
              Found in lib/cape/virtual_forms.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            for (key2 in value) {
                              if (value.hasOwnProperty(key2)) {
                                this._.setValue(key1 + '.' + key2, value[key2])
                              }
                            }
                Severity: Major
                Found in lib/cape/virtual_forms.js - About 45 mins to fix

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

                    ajax: function(httpMethod, path, params, callback, errorHandler) {
                  Severity: Minor
                  Found in lib/cape/mixins/agent_common_methods.js - About 35 mins to fix

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

                    Cape.merge = function() {
                      let i, key
                    
                      for (i = 1; i < arguments.length; i++)
                        for (key in arguments[i])
                    Severity: Minor
                    Found in lib/cape/utilities.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 getValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      getValue(name) {
                        let names, formName, attrName, form, _form
                    
                        names = this.getNames(name)
                        formName = names[0]
                    Severity: Minor
                    Found in lib/cape/virtual_forms.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 extractClassNames has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      extractClassNames(classNames, options) {
                        if (typeof options['className'] === 'object') {
                          for (let name in options['className']) {
                            if (options['className'][name]) classNames.push(name)
                          }
                    Severity: Minor
                    Found in lib/cape/markup_builder.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 show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      show(klass, params) {
                        this.query = {}
                        if (params !== undefined) {
                          for (let prop in params) {
                            if ({}.hasOwnProperty.call(params, prop)) {
                    Severity: Minor
                    Found in lib/cape/router.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

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

                      getComponentClassFor(route) {
                        let fragments = []
                        if (route.container) {
                          route.container.split('.').forEach(part => {
                            fragments.push(Inflector.camelize(part))
                    Severity: Minor
                    Found in lib/cape/router.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

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

                      mount(id) {
                        if (id === undefined)
                          throw new Error("The first argument is missing.")
                        if (typeof id !== 'string')
                          throw new Error("The first argument must be a string.")
                    Severity: Minor
                    Found in lib/cape/component.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

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

                      textareaField(attrName, options) {
                        let formName, vform, dasherized
                    
                        if (attrName && this.fieldNamePrefix)
                          attrName = this.fieldNamePrefix + '/' + attrName
                    Severity: Minor
                    Found in lib/cape/markup_builder.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

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

                      redirectTo(hash, params, options) {
                        // For backward compatibility, if the second argument has a key 'notice'
                        // or 'alert' and the third argument is undefined, the second argument
                        // should be treated as options.
                        if (typeof params === 'object' && options === undefined) {
                    Severity: Minor
                    Found in lib/cape/router.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