capejs/capejs

View on GitHub

Showing 41 of 65 total issues

File virtual_forms_test.js has 520 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict'

var isNode = typeof module !== 'undefined' && module.exports !== undefined

describe('VirtualForms', () => {
Severity: Major
Found in test/spec/virtual_forms_test.js - About 1 day to fix

    File router_test.js has 518 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict'
    
    describe('Router', () => {
      describe('constructor', () => {
        it('should have complete set of properties', () => {
    Severity: Major
    Found in test/spec/router_test.js - About 1 day to fix

      File routing_mapper_test.js has 479 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict'
      
      describe('RoutingMapper', () => {
        describe('page', () => {
          it('should add a route to specified component', () => {
      Severity: Minor
      Found in test/spec/routing_mapper_test.js - About 7 hrs to fix

        Function apply has a Cognitive Complexity of 48 (exceeds 5 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 7 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 markup_builder_test.js has 463 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict'
        
        var isNode = typeof module !== 'undefined' && module.exports !== undefined
        
        describe('MarkupBuilder', () => {
        Severity: Minor
        Found in test/spec/markup_builder_test.js - About 7 hrs to fix

          Function compile has a Cognitive Complexity of 45 (exceeds 5 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 6 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 markup_builder.js has 432 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict'
          
          let virtualDom = require('virtual-dom')
          let Inflector = require('inflected')
          let Cape = require('./utilities')
          Severity: Minor
          Found in lib/cape/markup_builder.js - About 6 hrs to fix

            File resource_agent_test.js has 400 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            'use strict'
            
            class UserAgent extends Cape.ResourceAgent {
              constructor(client, options) {
                super(client, options)
            Severity: Minor
            Found in test/spec/resource_agent_test.js - About 5 hrs to fix

              Function val has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                val(arg1, arg2) {
                  let key1, key2, value
              
                  if (typeof arg1 === 'object') {
                    for (key1 in arg1) {
              Severity: Minor
              Found in lib/cape/virtual_forms.js - About 3 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 collection_agent_test.js has 297 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              'use strict'
              
              class UserCollectionAgent extends Cape.CollectionAgent {
                constructor(client, options) {
                  super(client, options)
              Severity: Minor
              Found in test/spec/collection_agent_test.js - About 3 hrs to fix

                File virtual_forms.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                'use strict'
                
                let Cape = require('./utilities')
                
                // Cape.VirtualForms
                Severity: Minor
                Found in lib/cape/virtual_forms.js - About 3 hrs to fix

                  MarkupBuilder has 26 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class MarkupBuilder {
                    constructor(component, options) {
                      this._ = new _Internal(this)
                      this.component = component
                      if (options) {
                  Severity: Minor
                  Found in lib/cape/markup_builder.js - About 3 hrs to fix

                    File routing_mapper.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    'use strict'
                    
                    let Inflector = require('inflected')
                    let Cape = require('./utilities')
                    
                    
                    Severity: Minor
                    Found in lib/cape/routing_mapper.js - About 2 hrs to fix

                      ResourceAgent has 21 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ResourceAgent {
                        constructor(client, options) {
                          let adapterName, adapter
                      
                          options = options || {}
                      Severity: Minor
                      Found in lib/cape/resource_agent.js - About 2 hrs to fix

                        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
                              Severity
                              Category
                              Status
                              Source
                              Language