Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

Function addGroupAndOrderByToQuery has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private addGroupAndOrderByToQuery(
    selectQueryBuilder: SelectQueryBuilder<SourcingRecord>,
    impactDataDto: GetActualVsScenarioImpactTableDto | BaseImpactTableDto,
  ): SelectQueryBuilder<SourcingRecord> {
    switch (impactDataDto.groupBy) {
Severity: Minor
Found in api/src/modules/impact/impact.repository.ts - About 1 hr to fix

    Function getActualVsScenarioImpactMap has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async getActualVsScenarioImpactMap(
        dto: GetActualVsScenarioImpactMapDto,
      ): Promise<{ impactMap: H3IndexValueData[]; quantiles: number[] }> {
        const baseQueryExtend = (baseQuery: SelectQueryBuilder<any>): void => {
          //Add selection criteria to also select both comparedScenario in the select statement
    Severity: Minor
    Found in api/src/modules/h3-data/h3-data.repository.ts - About 1 hr to fix

      Function serializerConfig has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        get serializerConfig(): JSONAPISerializerConfig<User> {
          return {
            attributes: [
              'fname',
              'lname',
      Severity: Minor
      Found in api/src/modules/users/users.service.ts - About 1 hr to fix

        Function parseSourcingDataFromSheet has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async parseSourcingDataFromSheet(customData: WorkSheet[]): Promise<{
            sourcingData: SourcingData[];
          }> {
            this.logger.debug(`Cleaning ${customData.length} custom data rows`);
            const sourcingData: SourcingData[] = [];
        Severity: Minor
        Found in api/src/modules/import-data/sourcing-data/dto-processor.service.ts - About 1 hr to fix

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

            constructor(
              protected readonly geoRegionRepository: GeoRegionRepository,
              private readonly adminRegionService: AdminRegionsService,
              private readonly materialsService: MaterialsService,
              private readonly geoFeatures: GeoFeaturesService,
          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/scenario-interventions/scenario-interventions.service.ts on lines 44..55

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

          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

          export function useScenarioInterventions({
            scenarioId,
            params = {},
            options = {},
          }: {
          Severity: Major
          Found in client/src/hooks/interventions/index.ts and 1 other location - About 1 hr to fix
          client/src/hooks/interventions/index.ts on lines 42..68

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

          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

            constructor(
              protected readonly scenarioInterventionRepository: ScenarioInterventionRepository,
              protected readonly interventionBuilder: InterventionBuilder,
              protected readonly geoCodingService: GeoCodingAbstractClass,
              protected readonly sourcingLocationsService: SourcingLocationsService,
          api/src/modules/geo-regions/geo-regions.service.ts on lines 31..42

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

          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

          export function useIntervention({
            interventionId,
            params = {},
            options = {},
          }: {
          Severity: Major
          Found in client/src/hooks/interventions/index.ts and 1 other location - About 1 hr to fix
          client/src/hooks/interventions/index.ts on lines 18..40

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

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

          const MapPage: NextPageWithLayout = () => {
            const scrollRef = useRef<HTMLDivElement>(null);
            const { planetCompareLayer } = useAppSelector((state) => state.eudr);
            const [isCollapsed, setIsCollapsed] = useState(false);
          
          
          Severity: Minor
          Found in client/src/pages/eudr/index.tsx - About 1 hr to fix

            Function GroupByFilter has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const GroupByFilter: React.FC = () => {
              const { replace, query = {} } = useRouter();
              const dispatch = useAppDispatch();
              const filters = useAppSelector(analysisFilters);
            
            

              Function getImpactMap has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async getImpactMap(
                  dto: GetImpactMapDto,
                ): Promise<{ impactMap: H3IndexValueData[]; quantiles: number[] }> {
                  const baseQueryExtend = (baseQuery: SelectQueryBuilder<any>): void => {
                    //Having a scenarioId present as an argument, will change the query to include
              Severity: Minor
              Found in api/src/modules/h3-data/h3-data.repository.ts - About 1 hr to fix

                Function up has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public async up(queryRunner: QueryRunner): Promise<void> {
                    await queryRunner.query(`
                    CREATE OR REPLACE FUNCTION get_h3_material_table_column(h3DataId uuid)
                    RETURNS TABLE (h3_table_name varchar, h3_column_name varchar) AS
                    $$

                  Function extendFindAllQuery has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async extendFindAllQuery(
                      query: SelectQueryBuilder<SourcingLocation>,
                      fetchSpecification: Record<string, unknown>,
                    ): Promise<SelectQueryBuilder<SourcingLocation>> {
                      const sortingOrder: 'DESC' | 'ASC' | undefined =

                    Function getScenarioVsScenarioImpactMap has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      async getScenarioVsScenarioImpactMap(
                        dto: GetScenarioVsScenarioImpactMapDto,
                      ): Promise<{ impactMap: H3IndexValueData[]; quantiles: number[] }> {
                        const baseQueryExtend = (baseQuery: SelectQueryBuilder<any>): void => {
                          //Add selection criteria to also select both baseScenario and comparedScenario in the select statement
                    Severity: Minor
                    Found in api/src/modules/h3-data/h3-data.repository.ts - About 1 hr to fix

                      Function getAggregatedH3ByNameAndResolution has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        async getAggregatedH3ByNameAndResolution(
                          h3TableName: string,
                          h3ColumnName: string,
                          resolution: number,
                          aggregationType: CONTEXTUAL_LAYER_AGG_TYPE,
                      Severity: Minor
                      Found in api/src/modules/contextual-layers/contextual-layer.repository.ts - About 1 hr to fix

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

                                <motion.div
                                  className="relative hidden aspect-video"
                                  initial={{ opacity: 0, y: 20 }}
                                  animate={{ opacity: 1, y: 0 }}
                                  transition={{ duration: 0.75, delay: 0.1 }}
                        Severity: Major
                        Found in marketing/src/containers/methodology/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/home/hero/component.tsx on lines 40..47
                        marketing/src/containers/methodology/hero/component.tsx on lines 38..115
                        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 py-12 md:py-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/compliance/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/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 7 locations. Consider refactoring.
                        Open

                                  <motion.div
                                    className="relative"
                                    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 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 7 locations. Consider refactoring.
                        Open

                                <motion.div
                                  className="relative py-12 md:py-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/methodology/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/home/hero/component.tsx on lines 40..47
                        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 md:pb-16"
                                  initial={{ opacity: 0, y: 20 }}
                                  animate={{ opacity: 1, y: 0 }}
                                  transition={{ duration: 0.75, delay: 0.1 }}
                        Severity: Major
                        Found in marketing/src/containers/the-service/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/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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language