Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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

            <motion.a
              className="inline-block py-5 font-semibold text-white border-2 border-white px-9"
              initial={{ opacity: 0, y: 20 }}
              animate={{ opacity: 1, y: 0 }}
              transition={{ duration: 0.75, delay: 0.1 }}
Severity: Major
Found in marketing/src/containers/home/hero/component.tsx and 6 other locations - About 1 hr to fix
marketing/src/containers/about/hero/component.tsx on lines 11..65
marketing/src/containers/compliance/hero/component.tsx on lines 31..42
marketing/src/containers/home/hero/component.tsx on lines 19..37
marketing/src/containers/methodology/hero/component.tsx on lines 38..115
marketing/src/containers/methodology/hero/component.tsx on lines 117..135
marketing/src/containers/the-service/hero/component.tsx on lines 9..21

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

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

        <motion.div
          className="relative pt-12 md:pt-32"
          initial={{ opacity: 0, y: 20 }}
          animate={{ opacity: 1, y: 0 }}
          transition={{ duration: 0.75, delay: 0.1 }}
Severity: Major
Found in marketing/src/containers/about/hero/component.tsx and 6 other locations - About 1 hr to fix
marketing/src/containers/compliance/hero/component.tsx on lines 31..42
marketing/src/containers/home/hero/component.tsx on lines 19..37
marketing/src/containers/home/hero/component.tsx on lines 40..47
marketing/src/containers/methodology/hero/component.tsx on lines 38..115
marketing/src/containers/methodology/hero/component.tsx on lines 117..135
marketing/src/containers/the-service/hero/component.tsx on lines 9..21

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

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

  @ApiPropertyOptional({ enum: MATERIALS_ORDER_BY_VALUES })
  @IsOptional()
  @IsEnum(MATERIALS_ORDER_BY_VALUES, {
    message: `Available columns for orderBy: ${Object.values(
      MATERIALS_ORDER_BY_VALUES,
api/src/modules/sourcing-locations/dto/materials-query.sourcing-location.dto.ts on lines 28..35

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

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

  async getGeoRegionById(id: string): Promise<GeoRegion> {
    const found: GeoRegion | null = await this.geoRegionRepository.findOneBy({
      id,
    });

Severity: Major
Found in api/src/modules/geo-regions/geo-regions.service.ts and 1 other location - About 1 hr to fix
api/src/modules/indicator-coefficients/indicator-coefficients.service.ts on lines 43..53

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

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

  [INDICATOR_NAME_CODES.NCE]: {
    production: () =>
      `sum_material_over_georegion($1, $2, 'producer') as "${QueryPropertyNames.production}"`,
    [INDICATOR_NAME_CODES.NCE]: () =>
      `${get_annual_commodity_weighted_impact_over_georegion}($1, '${INDICATOR_NAME_CODES.NCE}', $2, 'producer') as "${INDICATOR_NAME_CODES.NCE}"`,
api/src/modules/indicator-records/services/impact-calculation.dependencies.ts on lines 75..80
api/src/modules/indicator-records/services/impact-calculation.dependencies.ts on lines 81..86

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

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

  async getIndicatorCoefficientById(id: string): Promise<IndicatorCoefficient> {
    const found: IndicatorCoefficient | null =
      await this.indicatorCoefficientRepository.findOneBy({ id });
    if (!found) {
      throw new NotFoundException(
api/src/modules/geo-regions/geo-regions.service.ts on lines 51..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 68.

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

  [INDICATOR_NAME_CODES.DF_SLUC]: {
    production: () =>
      `sum_material_over_georegion($1, $2, 'producer') as "${QueryPropertyNames.production}"`,
    [INDICATOR_NAME_CODES.DF_SLUC]: () =>
      `${get_annual_commodity_weighted_impact_over_georegion}($1, '${INDICATOR_NAME_CODES.DF_SLUC}', $2, 'producer') as "${INDICATOR_NAME_CODES.DF_SLUC}"`,
api/src/modules/indicator-records/services/impact-calculation.dependencies.ts on lines 81..86
api/src/modules/indicator-records/services/impact-calculation.dependencies.ts on lines 100..105

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

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

  @ApiPropertyOptional({ enum: ORDER_BY_OPTIONS })
  @IsOptional()
  @IsEnum(ORDER_BY_OPTIONS, {
    message: `Available columns for order: ${Object.values(
      ORDER_BY_OPTIONS,
api/src/modules/sourcing-locations/dto/materials-query.sourcing-location.dto.ts on lines 19..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 68.

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

  [INDICATOR_NAME_CODES.GHG_DEF_SLUC]: {
    production: () =>
      `sum_material_over_georegion($1, $2, 'producer') as "${QueryPropertyNames.production}"`,
    [INDICATOR_NAME_CODES.GHG_DEF_SLUC]: () =>
      `${get_annual_commodity_weighted_impact_over_georegion}($1,'${INDICATOR_NAME_CODES.GHG_DEF_SLUC}', $2, 'producer') as "${INDICATOR_NAME_CODES.GHG_DEF_SLUC}"`,
api/src/modules/indicator-records/services/impact-calculation.dependencies.ts on lines 75..80
api/src/modules/indicator-records/services/impact-calculation.dependencies.ts on lines 100..105

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

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

  async activateIndicators(
    indicatorsFromSheet: CreateIndicatorDto[],
  ): Promise<Indicator[]> {
    const nameCodesToActivateIndicatorsBy: string[] = indicatorsFromSheet
      .filter((i: CreateIndicatorDto) => i.status === INDICATOR_STATUS.ACTIVE)
Severity: Minor
Found in api/src/modules/indicators/indicators.service.ts - About 1 hr to fix

    Function getScenarioVsScenarioImpactTable has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async getScenarioVsScenarioImpactTable(
        dto: GetScenarioVsScenarioImpactTableDto,
        fetchSpecification: FetchSpecification,
      ): Promise<ScenarioVsScenarioPaginatedImpactTable> {
        const indicators: Indicator[] =
    Severity: Minor
    Found in api/src/modules/impact/comparison/scenario-vs-scenario.service.ts - About 1 hr to fix

      Function buildQuery has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        buildQuery(): Query {
          if (this.dto?.supplierIds) {
            this.queryBuilder.andWhere(
              `${EUDRAlertsFields.supplierId} IN (:...supplierIds)`,
              {

        Function getContextualLayerH3 has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async getContextualLayerH3(
            contextualLayerId: string,
            resolution?: number,
            year?: number,
          ): Promise<{
        Severity: Minor
        Found in api/src/modules/contextual-layers/contextual-layers.service.ts - About 1 hr to fix

          Function getFlowLineAttributesByIndex has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function getFlowLineAttributesByIndex(
            lineAttributes: FlowLinesLayerAttributes,
            index: number,
          ): FlowLinesLayerAttributes {
            const {
          Severity: Minor
          Found in cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.ts - About 1 hr to fix

            Function getColors has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function getColors(
              diffMode: boolean,
              schemeKey: string | undefined,
              darkMode: boolean,
              fadeEnabled: boolean,
            Severity: Minor
            Found in cookie-traceability/src/lib/flowmap/data/colors.ts - About 1 hr to fix

              Function CreateInterventionPage has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const CreateInterventionPage: React.FC = () => {
                const { query } = useRouter();
                const createIntervention = useCreateNewIntervention({
                  onSuccess: (_data, variables) => {
                    toast.success(`Intervention was created successfully`);
              Severity: Minor
              Found in client/src/pages/data/scenarios/[scenarioId]/interventions/new.tsx - About 1 hr to fix

                Function ChartPage has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const ChartPage: NextPageWithLayout = () => {
                  const dispatch = useAppDispatch();
                  const [syncedIndicators] = useSyncIndicators();
                
                  const { data, isLoading } = useIndicators(undefined, {
                Severity: Minor
                Found in client/src/pages/analysis/chart.tsx - About 1 hr to fix

                  Function addReplacingElementsToIntervention has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async addReplacingElementsToIntervention(
                      newIntervention: ScenarioIntervention,
                      newSourcingLocations: SourcingData[],
                      type: SCENARIO_INTERVENTION_TYPE,
                    ): Promise<ScenarioIntervention> {

                    Function addOrganisationalEntityFilters has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private addOrganisationalEntityFilters(
                        baseImpactMapFilters: BaseImpactMapFiltersType,
                        queryBuilder: { subQueryBuilder: SelectQueryBuilder<any> },
                      ): SelectQueryBuilder<any> {
                        const {
                    Severity: Minor
                    Found in api/src/modules/h3-data/h3-data.repository.ts - About 1 hr to fix

                      Function calculateIndicatorSumByYear has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        private calculateIndicatorSumByYear(
                          entityMap: Map<
                            string,
                            Map<number, ScenarioVsScenarioImpactTableRowsValues>
                          >,
                      Severity: Minor
                      Found in api/src/modules/impact/comparison/scenario-vs-scenario.service.ts - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language