Showing 313 of 321 total issues

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

                return model
                    .save()
                    .catch((e) => e)
                    .then(() => {
                        expect(modelDefinition.save).not.toBeCalled()
Severity: Major
Found in src/model/__tests__/ModelBase.spec.js and 2 other locations - About 1 hr to fix
src/model/__tests__/ModelBase.spec.js on lines 92..97
src/system/__tests__/System.spec.js on lines 505..510

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

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 3 locations. Consider refactoring.
Open

                return model
                    .create()
                    .catch((e) => e)
                    .then(() => {
                        expect(modelDefinition.save).not.toBeCalled()
Severity: Major
Found in src/model/__tests__/ModelBase.spec.js and 2 other locations - About 1 hr to fix
src/model/__tests__/ModelBase.spec.js on lines 124..129
src/system/__tests__/System.spec.js on lines 505..510

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

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

        addDimension(dimension, items) {
            let dimensionIndex = 0

            const existingDimension = this.dimensions.find((item, index) => {
                if (item.dimension === dimension) {
Severity: Minor
Found in src/analytics/AnalyticsRequestDimensionsMixin.js - About 1 hr to fix

    Function addFilter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            addFilter(dimension, items) {
                let filterIndex = 0
    
                const existingFilter = this.filters.find((item, index) => {
                    if (item.dimension === dimension) {
    Severity: Minor
    Found in src/analytics/AnalyticsRequestFiltersMixin.js - About 1 hr to fix

      Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          constructor(schema = {}, properties, validations, attributes, authorities) {
              checkType(schema.singular, 'string')
              checkType(schema.plural, 'string', 'Plural')
      
              addLockedProperty(this, 'name', schema.singular)
      Severity: Minor
      Found in src/model/ModelDefinition.js - About 1 hr to fix

        Function getOptions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function getOptions(defaultHeaders, mergeOptions, requestData) {
                    const resultOptions = Object.assign(
                        {},
                        api.defaultFetchOptions,
                        mergeOptions
        Severity: Minor
        Found in src/api/Api.js - About 1 hr to fix

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

                  describe('.extractRows()', () => {
                      it('should return the rows from the response', () => {
                          const rows = response.extractRows()
          
                          expect(rows).toHaveLength(312)
          Severity: Major
          Found in src/analytics/__tests__/AnalyticsResponse.spec.js and 1 other location - About 1 hr to fix
          src/analytics/__tests__/AnalyticsResponse.spec.js on lines 24..30

          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

              it('should have `rightSide` set to the correct values', () => {
                  const correctValues = {
                      missingValueStrategy: 'NEVER_SKIP',
                      description: '',
                      expression: '',
          src/model/config/model-defaults/__tests__/validationRule.spec.js on lines 26..34

          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 3 locations. Consider refactoring.
          Open

                  it('should not accept invalid periods', () => {
                      expect(() => getPeriodFromPeriodId('test')).toThrowError()
                      expect(() => getPeriodFromPeriodId('1234567890')).toThrowError()
                  })
          Severity: Major
          Found in src/period/__tests__/parser.spec.js and 2 other locations - About 1 hr to fix
          src/period/__tests__/parser.spec.js on lines 362..365
          src/period/__tests__/parser.spec.js on lines 506..509

          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 3 locations. Consider refactoring.
          Open

                  it('should not accept SixMonthlyNov periods below 1 or above 2', () => {
                      expect(() => getPeriodFromPeriodId('1981NovS0')).toThrowError()
                      expect(() => getPeriodFromPeriodId('1981NovS3')).toThrowError()
                  })
          Severity: Major
          Found in src/period/__tests__/parser.spec.js and 2 other locations - About 1 hr to fix
          src/period/__tests__/parser.spec.js on lines 362..365
          src/period/__tests__/parser.spec.js on lines 553..556

          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 3 locations. Consider refactoring.
          Open

              it('should log a warning', () => {
                  expect(logger.warn('my message')).toBe(true)
                  expect(consoleMock.warn).toBeCalledWith('my message')
              })
          Severity: Major
          Found in src/logger/__tests__/Logger.spec.js and 2 other locations - About 1 hr to fix
          src/logger/__tests__/Logger.spec.js on lines 58..61
          src/logger/__tests__/Logger.spec.js on lines 69..72

          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

              it('should have `leftSide` set to the correct values', () => {
                  const correctValues = {
                      missingValueStrategy: 'NEVER_SKIP',
                      description: '',
                      expression: '',
          src/model/config/model-defaults/__tests__/validationRule.spec.js on lines 36..44

          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 3 locations. Consider refactoring.
          Open

              it('should log a debug request', () => {
                  expect(logger.debug('my message')).toBe(true)
                  expect(consoleMock.debug).toBeCalledWith('my message')
              })
          Severity: Major
          Found in src/logger/__tests__/Logger.spec.js and 2 other locations - About 1 hr to fix
          src/logger/__tests__/Logger.spec.js on lines 53..56
          src/logger/__tests__/Logger.spec.js on lines 69..72

          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

                  describe('.extractHeaders()', () => {
                      it('should return the headers from the response', () => {
                          const headers = response.extractHeaders()
          
                          expect(headers).toHaveLength(4)
          Severity: Major
          Found in src/analytics/__tests__/AnalyticsResponse.spec.js and 1 other location - About 1 hr to fix
          src/analytics/__tests__/AnalyticsResponse.spec.js on lines 32..38

          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 3 locations. Consider refactoring.
          Open

                  it('should not accept invalid Daily periods', () => {
                      expect(() => getPeriodFromPeriodId('19813103')).toThrowError()
                      expect(() => getPeriodFromPeriodId('20170000')).toThrowError()
                  })
          Severity: Major
          Found in src/period/__tests__/parser.spec.js and 2 other locations - About 1 hr to fix
          src/period/__tests__/parser.spec.js on lines 506..509
          src/period/__tests__/parser.spec.js on lines 553..556

          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 3 locations. Consider refactoring.
          Open

              it('should log an error request', () => {
                  expect(logger.error('my message')).toBe(true)
                  expect(consoleMock.error).toBeCalledWith('my message')
              })
          Severity: Major
          Found in src/logger/__tests__/Logger.spec.js and 2 other locations - About 1 hr to fix
          src/logger/__tests__/Logger.spec.js on lines 53..56
          src/logger/__tests__/Logger.spec.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 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

              describe('getSystem', () => {
                  it('should return the same instance on consecutive requests', () => {
                      expect(System.getSystem()).toBe(System.getSystem())
                  })
              })
          Severity: Major
          Found in src/system/__tests__/System.spec.js and 1 other location - About 1 hr to fix
          src/analytics/__tests__/Analytics.spec.js on lines 37..41

          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

              it('should return true if the user does not have an authority but does have ALL', () => {
                  userAuthorities = UserAuthorities.create(['F_DATAVALUE_DELETE', 'ALL'])
          
                  expect(userAuthorities.has('F_DOCUMENT_PUBLIC_DELETE')).toBe(true)
              })
          Severity: Minor
          Found in src/current-user/__tests__/UserAuthorities.spec.js and 1 other location - About 55 mins to fix
          src/current-user/__tests__/UserAuthorities.spec.js on lines 32..36

          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

              it('should return true when asking for ALL and the user has the authority', () => {
                  userAuthorities = UserAuthorities.create(['F_DATAVALUE_DELETE', 'ALL'])
          
                  expect(userAuthorities.has('ALL')).toBe(true)
              })
          Severity: Minor
          Found in src/current-user/__tests__/UserAuthorities.spec.js and 1 other location - About 55 mins to fix
          src/current-user/__tests__/UserAuthorities.spec.js on lines 22..26

          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

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

          function createModelPropertyDescriptor(propertiesObject, schemaProperty) {
              const propertyName = schemaProperty.collection
                  ? schemaProperty.collectionName
                  : schemaProperty.name
              const propertyDetails = {
          Severity: Minor
          Found in src/model/ModelDefinition.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

          Severity
          Category
          Status
          Source
          Language