Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

Function paramsToQueryInjector has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const paramsToQueryInjector = (
  params: string[],
  query: string,
): string => {
  while (query.includes('$')) {
Severity: Minor
Found in api/src/utils/helpers/params-to-query-injector.helper.ts - About 1 hr to fix

    Function generateNewLocationForChangeProductionEfficiency has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      generateNewLocationForChangeProductionEfficiency(
        sourcingLocations: SourcingLocation[],
      ): SourcingLocation[] {
        const newLocations: SourcingLocation[] = [];
        for (const location of sourcingLocations) {

      Function baseQueryExtend has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const baseQueryExtend = (baseQuery: SelectQueryBuilder<any>): void => {
            //Add selection criteria to also select both comparedScenario in the select statement
            baseQuery
              .leftJoin(
                ScenarioIntervention,
      Severity: Minor
      Found in api/src/modules/h3-data/h3-data.repository.ts - About 1 hr to fix

        Function baseQueryExtend has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const baseQueryExtend = (baseQuery: SelectQueryBuilder<any>): void => {
              //Having a scenarioId present as an argument, will change the query to include
              // *all* indicator records of the interventions pertaining to that scenario (both
              // the CANCELLED and REPLACING records)
              if (dto.scenarioId) {
        Severity: Minor
        Found in api/src/modules/h3-data/h3-data.repository.ts - About 1 hr to fix

          Function validate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            validate(longitudeInput: number, args: ValidationArguments): boolean {
              if (
                (args.object as SourcingDataExcelValidator).location_type ===
                  LOCATION_TYPES.UNKNOWN ||
                (args.object as SourcingDataExcelValidator).location_type ===

            Function validate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              validate(latitudeInput: number, args: ValidationArguments): boolean {
                if (
                  (args.object as SourcingDataExcelValidator).location_type ===
                    LOCATION_TYPES.UNKNOWN ||
                  (args.object as SourcingDataExcelValidator).location_type ===

              Function Video has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Video: React.FC = () => {
                const videoRef = useRef<HTMLVideoElement>();
                const { ref, inView } = useInView();
              
                useEffect(() => {
              Severity: Minor
              Found in marketing/src/containers/about/video/component.tsx - About 1 hr to fix

                Function buildQueryForImport has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  buildQueryForImport(nameCodes: INDICATOR_NAME_CODES[]): {
                    params: string;
                    query: string;
                  } {
                    const importQueryFields: string[] = [

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

                  export class UpdateIndicatorDto extends PartialType(CreateIndicatorDto) {
                    @IsString()
                    @IsOptional()
                    @MinLength(2)
                    @MaxLength(40)
                  Severity: Major
                  Found in api/src/modules/indicators/dto/update.indicator.dto.ts and 5 other locations - About 1 hr to fix
                  api/src/modules/admin-regions/dto/update.admin-region.dto.ts on lines 5..12
                  api/src/modules/business-units/dto/update.business-unit.dto.ts on lines 5..12
                  api/src/modules/geo-regions/dto/update.geo-region.dto.ts on lines 5..12
                  api/src/modules/materials/dto/update.material.dto.ts on lines 5..12
                  api/src/modules/suppliers/dto/update.supplier.dto.ts on lines 5..12

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

                  export class UpdateGeoRegionDto extends PartialType(CreateGeoRegionDto) {
                    @IsString()
                    @IsOptional()
                    @MinLength(2)
                    @MaxLength(40)
                  Severity: Major
                  Found in api/src/modules/geo-regions/dto/update.geo-region.dto.ts and 5 other locations - About 1 hr to fix
                  api/src/modules/admin-regions/dto/update.admin-region.dto.ts on lines 5..12
                  api/src/modules/business-units/dto/update.business-unit.dto.ts on lines 5..12
                  api/src/modules/indicators/dto/update.indicator.dto.ts on lines 5..12
                  api/src/modules/materials/dto/update.material.dto.ts on lines 5..12
                  api/src/modules/suppliers/dto/update.supplier.dto.ts on lines 5..12

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

                  export class UpdateSupplierDto extends PartialType(CreateSupplierDto) {
                    @IsString()
                    @IsOptional()
                    @MinLength(2)
                    @MaxLength(300)
                  Severity: Major
                  Found in api/src/modules/suppliers/dto/update.supplier.dto.ts and 5 other locations - About 1 hr to fix
                  api/src/modules/admin-regions/dto/update.admin-region.dto.ts on lines 5..12
                  api/src/modules/business-units/dto/update.business-unit.dto.ts on lines 5..12
                  api/src/modules/geo-regions/dto/update.geo-region.dto.ts on lines 5..12
                  api/src/modules/indicators/dto/update.indicator.dto.ts on lines 5..12
                  api/src/modules/materials/dto/update.material.dto.ts on lines 5..12

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

                  export class UpdateAdminRegionDto extends PartialType(CreateAdminRegionDto) {
                    @IsString()
                    @IsOptional()
                    @MinLength(2)
                    @MaxLength(40)
                  api/src/modules/business-units/dto/update.business-unit.dto.ts on lines 5..12
                  api/src/modules/geo-regions/dto/update.geo-region.dto.ts on lines 5..12
                  api/src/modules/indicators/dto/update.indicator.dto.ts on lines 5..12
                  api/src/modules/materials/dto/update.material.dto.ts on lines 5..12
                  api/src/modules/suppliers/dto/update.supplier.dto.ts on lines 5..12

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

                  export class UpdateMaterialDto extends PartialType(CreateMaterialDto) {
                    @IsString()
                    @IsOptional()
                    @MinLength(2)
                    @MaxLength(40)
                  Severity: Major
                  Found in api/src/modules/materials/dto/update.material.dto.ts and 5 other locations - About 1 hr to fix
                  api/src/modules/admin-regions/dto/update.admin-region.dto.ts on lines 5..12
                  api/src/modules/business-units/dto/update.business-unit.dto.ts on lines 5..12
                  api/src/modules/geo-regions/dto/update.geo-region.dto.ts on lines 5..12
                  api/src/modules/indicators/dto/update.indicator.dto.ts on lines 5..12
                  api/src/modules/suppliers/dto/update.supplier.dto.ts on lines 5..12

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

                  export class UpdateBusinessUnitDto extends PartialType(CreateBusinessUnitDto) {
                    @IsString()
                    @IsOptional()
                    @MinLength(2)
                    @MaxLength(40)
                  api/src/modules/admin-regions/dto/update.admin-region.dto.ts on lines 5..12
                  api/src/modules/geo-regions/dto/update.geo-region.dto.ts on lines 5..12
                  api/src/modules/indicators/dto/update.indicator.dto.ts on lines 5..12
                  api/src/modules/materials/dto/update.material.dto.ts on lines 5..12
                  api/src/modules/suppliers/dto/update.supplier.dto.ts on lines 5..12

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

                    @IsUUID(4, { each: true })
                    @IsOptional()
                    @ApiPropertyOptional({
                      description: 'Ids of T1 Suppliers that will be affected by intervention',
                      type: [String],
                  api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts on lines 106..113
                  api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts on lines 124..131
                  api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts on lines 133..140

                  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

                    getFadeEnabled: Selector<L, F, boolean> = (state: FlowMapState, props: FlowMapData<L, F>) =>
                      state.settingsState.fadeEnabled;
                  cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.ts on lines 109..110
                  cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.ts on lines 118..119

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

                  export const indicatorResource: BaseServiceResource = {
                    className: 'Indicator',
                    name: {
                      singular: 'indicator',
                      plural: 'indicators',
                  Severity: Major
                  Found in api/src/modules/indicators/indicator.entity.ts and 3 other locations - About 1 hr to fix
                  api/src/modules/indicator-records/indicator-record.entity.ts on lines 19..32
                  api/src/modules/scenarios/scenario.entity.ts on lines 21..29
                  api/src/modules/users/user.entity.ts on lines 21..29

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

                    @IsUUID(4, { each: true })
                    @IsOptional()
                    @ApiProperty({
                      description: 'Ids of Admin Regions that will be affected by intervention',
                      type: [String],
                  api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts on lines 106..113
                  api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts on lines 115..122
                  api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts on lines 124..131

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

                    @ManyToOne(
                      () => GeoRegion,
                      (geoRegion: GeoRegion) => geoRegion.sourcingLocations,
                      { eager: true },
                    )
                  api/src/modules/indicator-records/indicator-record.entity.ts on lines 81..85
                  api/src/modules/sourcing-locations/sourcing-location.entity.ts on lines 194..202
                  api/src/modules/targets/target.entity.ts on lines 42..46

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

                    @IsUUID(4, { each: true })
                    @IsOptional()
                    @ApiPropertyOptional({
                      description: 'Ids of Business Units that will be affected by intervention',
                      type: [String],
                  api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts on lines 115..122
                  api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts on lines 124..131
                  api/src/modules/scenario-interventions/dto/create.scenario-intervention.dto.ts on lines 133..140

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language