Showing 313 of 321 total issues

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

            return unloadedWithValues.load().then(() => {
                expect(api.get).toHaveBeenCalledWith(
                    [
                        mockParentModel.modelDefinition.apiEndpoint,
                        mockParentModel.id,
Severity: Major
Found in src/model/__tests__/ModelCollectionProperty.spec.js and 1 other location - About 1 hr to fix
src/model/__tests__/ModelCollectionProperty.spec.js on lines 421..434

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

            it('should add the ou dimension', () => {
                request.addOrgUnitDimension(['ImspTQPwCqd'])

                expect(request.dimensions).toEqual([
                    { dimension: 'ou', items: ['ImspTQPwCqd'] },
Severity: Major
Found in src/analytics/__tests__/AnalyticsRequest.spec.js and 1 other location - About 1 hr to fix
src/analytics/__tests__/AnalyticsRequest.spec.js on lines 218..224

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

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 add the ou dimension filter', () => {
                request.addOrgUnitFilter(['ImspTQPwCqd'])

                expect(request.filters).toEqual([
                    { dimension: 'ou', items: ['ImspTQPwCqd'] },
Severity: Major
Found in src/analytics/__tests__/AnalyticsRequest.spec.js and 1 other location - About 1 hr to fix
src/analytics/__tests__/AnalyticsRequest.spec.js on lines 121..127

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

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

function createValidationSetting(validationObject, schemaProperty) {
    const propertyName = schemaProperty.collection
        ? schemaProperty.collectionName
        : schemaProperty.name
    const validationDetails = {
Severity: Minor
Found in src/model/ModelDefinition.js - About 1 hr to fix

    Function getModelRequests has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getModelRequests(api, schemaNames) {
        const modelRequests = []
        const loadSchemaForName = (schemaName) =>
            api.get(`schemas/${schemaName}`, { fields: fieldsForSchemas })
    
    
    Severity: Minor
    Found in src/d2.js - About 1 hr to fix

      Function sortOrganisationUnitsHierarchy has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          sortOrganisationUnitsHierarchy() {
              const organisationUnits = this.metaData.dimensions.ou
      
              organisationUnits.forEach((organisationUnit, i) => {
                  const hierarchyPrefix = this.metaData.ouHierarchy[organisationUnit]
      Severity: Minor
      Found in src/analytics/AnalyticsResponse.js - About 1 hr to fix

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

                    const fetchOptions = {
                        body: '{}',
                        cache: 'default',
                        credentials: 'include',
                        headers: {
        Severity: Major
        Found in src/api/__tests__/Api.spec.js and 1 other location - About 1 hr to fix
        src/api/__tests__/Api.spec.js on lines 799..811

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

        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

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

                        const fetchOptions = {
                            body: '{}',
                            cache: 'default',
                            credentials: 'include',
                            headers: {
        Severity: Major
        Found in src/api/__tests__/Api.spec.js and 1 other location - About 1 hr to fix
        src/api/__tests__/Api.spec.js on lines 766..778

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

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

            constructor(modelDefinition) {
                super()
                checkType(modelDefinition, 'object', 'modelDefinition')
                checkType(modelDefinition.modelProperties, 'object', 'modelProperties')
        
        
        Severity: Minor
        Found in src/model/Model.js - About 1 hr to fix

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

                      Object.keys(singleUserAllFields).forEach((key) => {
                          model.dataValues[key] = singleUserAllFields[key]
                          model[key] = singleUserAllFields[key]
                      })
          Severity: Major
          Found in src/model/__tests__/ModelDefinition.spec.js and 1 other location - About 1 hr to fix
          src/model/__tests__/ModelDefinition.spec.js on lines 1378..1381

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

          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

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

                      Object.keys(singleUserAllFields).forEach((key) => {
                          model.dataValues[key] = singleUserAllFields[key]
                          model[key] = singleUserAllFields[key]
                      })
          Severity: Major
          Found in src/model/__tests__/ModelDefinition.spec.js and 1 other location - About 1 hr to fix
          src/model/__tests__/ModelDefinition.spec.js on lines 1195..1198

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

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

              set(key, value) {
                  const that = this
                  let req
          
                  if (key === 'systemId') {
          Severity: Minor
          Found in src/system/SystemConfiguration.js - About 1 hr to fix

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

                get(key) {
                    if (this.settings && this.settings[key]) {
                        return Promise.resolve(this.settings[key])
                    }
            
            
            Severity: Minor
            Found in src/current-user/UserSettings.js - About 1 hr to fix

              Function createModelPropertyDescriptor has 28 lines of code (exceeds 25 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 1 hr to fix

                Function set has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                set(value) {
                                    const attributeValue = getAttributeValues()
                                        .filter((av) => av.attribute.name === attributeName)
                                        .reduce((current, av) => av, undefined)
                
                
                Severity: Minor
                Found in src/model/helpers/attibutes.js - About 1 hr to fix

                  Function createPeriodGeneratorsForLocale has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function createPeriodGeneratorsForLocale(locale = 'en') {
                      return {
                          generateDailyPeriodsForYear: (year) =>
                              generateDailyPeriodsForYear(year, locale),
                          generateWeeklyPeriodsForYear: (year) =>
                  Severity: Minor
                  Found in src/period/generators/index.js - About 1 hr to fix

                    Function fromModel has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        fromModel(model, passFilterAsDimension = false) {
                            let request = this
                    
                            // extract dimensions from model
                            const columns = model.columns || []
                    Severity: Minor
                    Found in src/analytics/AnalyticsRequest.js - About 1 hr to fix

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

                                      expect.objectContaining(
                                          Object.assign(baseFetchOptions, {
                                              method: 'PATCH',
                                              headers: new Headers({
                                                  'Content-Type': 'application/json',
                      Severity: Major
                      Found in src/api/__tests__/Api.spec.js and 1 other location - About 1 hr to fix
                      src/api/__tests__/Api.spec.js on lines 750..759

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

                                      expect.objectContaining(
                                          Object.assign(baseFetchOptions, {
                                              method: 'PUT',
                                              headers: new Headers({
                                                  'Content-Type': 'application/json',
                      Severity: Major
                      Found in src/api/__tests__/Api.spec.js and 1 other location - About 1 hr to fix
                      src/api/__tests__/Api.spec.js on lines 855..864

                      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 system
                                      .reloadApps()
                                      .catch((message) => message)
                                      .then(() => {
                                          expect(system.loadInstalledApps).not.toBeCalled()
                      Severity: Major
                      Found in src/system/__tests__/System.spec.js and 2 other locations - About 1 hr to fix
                      src/model/__tests__/ModelBase.spec.js on lines 92..97
                      src/model/__tests__/ModelBase.spec.js on lines 124..129

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language