capejs/capejs

View on GitHub

Showing 65 of 65 total issues

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

        render(m) {
          m.formFor('', m => {
            m.hiddenField('dummy')
            m.labelFor('name', 'Name').sp().textField('name').br()
            m.labelFor('password', 'Password').sp().passwordField('name').br()
Severity: Minor
Found in test/spec/markup_builder_test.js - About 1 hr to fix

    Function setValuesOfNestedFields has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      setValuesOfNestedFields(formName, prefix, obj) {
        let attrName, key, self
    
        for (key in obj) {
          attrName = prefix ? prefix + '/' + key : key
    Severity: Minor
    Found in lib/cape/virtual_forms.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 object2array has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      object2array(obj) {
        let isArray = true, _obj, key, ary = []
    
        _obj = Cape.deepExtend({}, obj)
        for (key in _obj) {
    Severity: Minor
    Found in lib/cape/virtual_forms.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 update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      update(formName, options) {
        let tForm
    
        tForm = this._.tempForms[formName]
        if (tForm === undefined) {
    Severity: Minor
    Found in lib/cape/virtual_forms.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 apply has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      apply() {
        let forms, i, len, form, formName, tForm, j, elements, elem, elemName, k
    
        forms = this.component.root.getElementsByTagName('form')
    
    
    Severity: Minor
    Found in lib/cape/virtual_forms.js - About 1 hr to fix

      Function compile has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        compile() {
          let forms, elements, i, j, elem, segments, lastSegment, obj, o, name
      
          this.realForms = {}
          forms = this.main.component.root.getElementsByTagName('form')
      Severity: Minor
      Found in lib/cape/virtual_forms.js - About 1 hr to fix

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

            for (let i = 0, len = this._.notificationListeners.length; i < len; i++) {
              if (this._.notificationListeners[i] === listener) return
            }
        Severity: Major
        Found in lib/cape/router.js and 1 other location - About 1 hr to fix
        lib/cape/mixins/propagator_methods.js on lines 6..8

        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

            for (let i = 0, len = this._.components.length; i < len; i++) {
              if (this._.components[i] === component) return
            }
        Severity: Major
        Found in lib/cape/mixins/propagator_methods.js and 1 other location - About 1 hr to fix
        lib/cape/router.js on lines 160..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 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 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

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

                  if (window.removeEventListener)
                    window.removeEventListener('hashchange', this._.eventListener, false)
                  else if (window.detachEvent)
                    window.detachEvent('onhashchange', this._.eventListener)
              Severity: Major
              Found in lib/cape/router.js and 1 other location - About 1 hr to fix
              lib/cape/router.js on lines 53..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 58.

              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 (i = attrNames.length; i--;) {
                attrName = attrNames[i]
                MarkupBuilder.prototype[attrName] = new Function("value",
                  "this.attr('" + attrName + "', value); return this")
              }
              Severity: Major
              Found in lib/cape/markup_builder.js and 1 other location - About 1 hr to fix
              lib/cape/markup_builder.js on lines 513..517

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

              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 (i = voidElementNames.length; i--;) {
                tagName = voidElementNames[i]
                MarkupBuilder.prototype[tagName] = new Function("options",
                  "this.elem('" + tagName + "', options); return this")
              }
              Severity: Major
              Found in lib/cape/markup_builder.js and 1 other location - About 1 hr to fix
              lib/cape/markup_builder.js on lines 521..525

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

              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 (window.addEventListener)
                    window.addEventListener('hashchange', this._.eventListener, false)
                  else if (window.attachEvent)
                    window.attachEvent('onhashchange', this._.eventListener)
              Severity: Major
              Found in lib/cape/router.js and 1 other location - About 1 hr to fix
              lib/cape/router.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 58.

              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

                update(afterUpdate, errorHandler) {
                  let path = this.singular ? this.singularPath() : this.memberPath()
                  return this._create_or_update('PATCH', path, afterUpdate, errorHandler)
                }
              Severity: Major
              Found in lib/cape/resource_agent.js and 1 other location - About 1 hr to fix
              lib/cape/resource_agent.js on lines 122..125

              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

                create(afterCreate, errorHandler) {
                  let path = this.singular ? this.singularPath() : this.collectionPath()
                  return this._create_or_update('POST', path, afterCreate, errorHandler)
                }
              Severity: Major
              Found in lib/cape/resource_agent.js and 1 other location - About 1 hr to fix
              lib/cape/resource_agent.js on lines 127..130

              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

                val(arg1, arg2) {
                  if (arguments.length === 1)
                    return this.parent.val(arg1)
                  else
                    return this.parent.val(arg1, arg2)
              Severity: Minor
              Found in lib/cape/partial.js and 1 other location - About 55 mins to fix
              lib/cape/component.js on lines 75..80

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

              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

                val(arg1, arg2) {
                  if (arguments.length === 1)
                    return this.virtualForms.val(arg1)
                  else
                    return this.virtualForms.val(arg1, arg2)
              Severity: Minor
              Found in lib/cape/component.js and 1 other location - About 55 mins to fix
              lib/cape/partial.js on lines 19..24

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

              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