Showing 59 of 321 total issues

File ModelDefinition.spec.js has 1378 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import fixtures from '../../__fixtures__/fixtures'
import { DIRTY_PROPERTY_LIST } from '../ModelBase'
import Model from '../Model'
import ModelDefinitions from '../ModelDefinitions'
import ModelCollectionProperty from '../ModelCollectionProperty'
Severity: Major
Found in src/model/__tests__/ModelDefinition.spec.js - About 3 days to fix

    File Api.spec.js has 790 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import FormData from 'form-data'
    import System from '../../system/System'
    import fixtures from '../../__fixtures__/fixtures'
    import Api from '../Api'
    
    
    Severity: Major
    Found in src/api/__tests__/Api.spec.js - About 1 day to fix

      File ModelBase.spec.js has 627 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import ModelValidation from '../ModelValidation'
      import ModelBase, { DIRTY_PROPERTY_LIST } from '../ModelBase'
      
      jest.mock('../ModelValidation')
      
      
      Severity: Major
      Found in src/model/__tests__/ModelBase.spec.js - About 1 day to fix

        Function AnalyticsRequestPropertiesMixin has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
        Open

        const AnalyticsRequestPropertiesMixin = (base) =>
            class extends base {
                /**
                 * Sets the query parameters of the request
                 *
        Severity: Minor
        Found in src/analytics/AnalyticsRequestPropertiesMixin.js - About 1 day 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 System.spec.js has 560 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import fixtures from '../../__fixtures__/fixtures'
        import MockApi from '../../api/Api'
        import System from '../System'
        import SystemConfiguration from '../SystemConfiguration'
        import SystemSettings from '../SystemSettings'
        Severity: Major
        Found in src/system/__tests__/System.spec.js - About 1 day to fix

          File parser.spec.js has 517 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { getPeriodFromPeriodId } from '../parser'
          
          function makePeriodFixture(id, name, startDate, endDate, type) {
              return { id, name, startDate, endDate, type }
          }
          Severity: Major
          Found in src/period/__tests__/parser.spec.js - About 1 day to fix

            File d2.spec.js has 420 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import Api from '../api/Api'
            import fixtures from '../__fixtures__/fixtures'
            import I18n from '../i18n/I18n'
            import DataStore from '../datastore/DataStore'
            import Logger from '../logger/Logger'
            Severity: Minor
            Found in src/__tests__/d2.spec.js - About 6 hrs to fix

              File index.spec.js has 406 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { createPeriodGeneratorsForLocale } from '..'
              import * as daily from '../daily'
              import * as weekly from '../weekly'
              import * as monthly from '../monthly'
              import * as bimonthly from '../bi-monthly'
              Severity: Minor
              Found in src/period/generators/__tests__/index.spec.js - About 5 hrs to fix

                Function request has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    request(method, url, data, options = {}) {
                        checkType(method, 'string', 'Request type')
                        checkType(url, 'string', 'Url')
                        const api = this
                        let requestUrl = url
                Severity: Major
                Found in src/api/Api.js - About 5 hrs to fix

                  File ModelCollectionProperty.spec.js has 389 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import fixtures from '../../__fixtures__/fixtures'
                  import Api from '../../api/Api'
                  import Model from '../Model'
                  import ModelDefinition from '../ModelDefinition'
                  import ModelCollectionProperty from '../ModelCollectionProperty'
                  Severity: Minor
                  Found in src/model/__tests__/ModelCollectionProperty.spec.js - About 5 hrs to fix

                    File ModelDefinition.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { checkType, isObject, checkDefined, isDefined } from '../lib/check'
                    import {
                        addLockedProperty,
                        curry,
                        copyOwnProperties,
                    Severity: Minor
                    Found in src/model/ModelDefinition.js - About 4 hrs to fix

                      Function x has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default (function x() {
                          const fixtures = {}
                      
                          function getFixture(fixtureName) {
                              if (fixtures && fixtures[fixtureName]) {
                      Severity: Major
                      Found in src/__fixtures__/fixtures.js - About 4 hrs to fix

                        Function init has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function init(initConfig, ApiClass = Api, logger = Logger.getLogger()) {
                            const api = ApiClass.getApi()
                        
                            const config = Config.create(preInitConfig, initConfig)
                        
                        
                        Severity: Major
                        Found in src/d2.js - About 3 hrs to fix

                          File AnalyticsRequestPropertiesMixin.js has 327 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /* eslint no-console: 0 */
                          
                          import AnalyticsRequest from './AnalyticsRequest'
                          
                          /**
                          Severity: Minor
                          Found in src/analytics/AnalyticsRequestPropertiesMixin.js - About 3 hrs to fix

                            File I18n.spec.js has 304 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import MockApi from '../../api/Api'
                            import I18n from '../I18n'
                            
                            jest.mock('../../api/Api')
                            
                            
                            Severity: Minor
                            Found in src/i18n/__tests__/I18n.spec.js - About 3 hrs to fix

                              File parser.js has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import {
                                  getMonthNamesForLocale,
                                  formatAsISODate,
                                  getLastDateOfMonth,
                                  getFirstDateOfQuarter,
                              Severity: Minor
                              Found in src/period/parser.js - About 3 hrs to fix

                                File Model.spec.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import fixtures from '../../__fixtures__/fixtures'
                                import Model from '../Model'
                                import ModelDefinition from '../ModelDefinition'
                                
                                describe('Model', () => {
                                Severity: Minor
                                Found in src/model/__tests__/Model.spec.js - About 3 hrs to fix

                                  Function request has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      request(method, url, data, options = {}) {
                                          checkType(method, 'string', 'Request type')
                                          checkType(url, 'string', 'Url')
                                          const api = this
                                          let requestUrl = url
                                  Severity: Minor
                                  Found in src/api/Api.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 SystemConfiguration.spec.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import MockApi from '../../api/Api'
                                  import SystemConfiguration from '../SystemConfiguration'
                                  
                                  jest.mock('../../api/Api')
                                  
                                  
                                  Severity: Minor
                                  Found in src/system/__tests__/SystemConfiguration.spec.js - About 3 hrs to fix

                                    File Api.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    /**
                                     * @module api
                                     */
                                    import 'isomorphic-fetch'
                                    import { checkType } from '../lib/check'
                                    Severity: Minor
                                    Found in src/api/Api.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language