Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      'CREATE OR REPLACE FUNCTION sum_weighted_deforestation_over_georegion(\n' +
        '    geo_region_id uuid,\n' +
        '    material_id uuid,\n' +

    Function createBasicSelectQuery has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private createBasicSelectQuery(
        impactDataDto: GetActualVsScenarioImpactTableDto | BaseImpactTableDto,
      ): SelectQueryBuilder<SourcingRecord> {
        const basicSelectQuery: SelectQueryBuilder<SourcingRecord> =
          this.entityManager
    Severity: Major
    Found in api/src/modules/impact/impact.repository.ts - About 2 hrs to fix

      Function saveListToTree has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public async saveListToTree(
          importData: CreateDto[],
          pathKey: keyof CreateDto,
        ): Promise<Entity[]> {
          let rest: (CreateDto & WithExplodedPath)[] = importData.map(
      Severity: Major
      Found in api/src/utils/tree.repository.ts - About 2 hrs to fix

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

        def merge_faostat_country(df, countries_df, output_file):
            # Merge the data with the country geometry
            df = df.merge(countries_df, left_on="Area Code (ISO3)", right_on="isoA3")
            # Set geoeometry and crs
            df = df.set_geometry("theGeom")
        Severity: Major
        Found in data/preprocessing/farm_ghg/preprocess_faostats.py and 1 other location - About 2 hrs to fix
        data/preprocessing/livestock_processed/preprocess_faostats_ha_prod.py on lines 84..94

        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

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

        def merge_faostat_country(df, countries_df, output_file):
            # Merge the data with the country geometry
            df = df.merge(countries_df, left_on="Area Code (ISO3)", right_on="isoA3")
            # Set geoeometry and crs
            df = df.set_geometry("theGeom")
        data/preprocessing/farm_ghg/preprocess_faostats.py on lines 78..88

        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

        File create.scenario-intervention.dto.ts has 284 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
        import {
          ArrayMaxSize,
          ArrayNotEmpty,
          IsEnum,

          File component.tsx has 284 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import cx from 'classnames';
          
          import { useForm } from 'react-hook-form';
          import { yupResolver } from '@hookform/resolvers/yup';
          import * as yup from 'yup';
          Severity: Minor
          Found in marketing/src/containers/contact/component.tsx - About 2 hrs to fix

            Function DownloadMaterialsDataButton has 70 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const DownloadMaterialsDataButton: React.FC = () => {
              const [isDownloading, setIsDownloading] = useState<boolean>(false);
            
              const {
                data: sourcingLocations,

              Function SupplierSourcingInfo has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const SupplierSourcingInfo = (): JSX.Element => {
                const { supplierId }: { supplierId: string } = useParams();
                const {
                  filters: { dates },
                } = useAppSelector(eudrDetail);
              Severity: Major
              Found in client/src/containers/analysis-eudr-detail/sourcing-info/index.tsx - About 2 hrs to fix

                Function ImpactLayer has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const ImpactLayer = () => {
                  const searchParams = useSearchParams();
                  const isComparisonEnabled = Boolean(searchParams.get('compareScenarioId'));
                
                  const dispatch = useAppDispatch();

                  Function down has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public async down(queryRunner: QueryRunner): Promise<void> {
                      await queryRunner.query(
                        'CREATE OR REPLACE FUNCTION sum_weighted_deforestation_over_georegion(\n' +
                          '    geo_region_id uuid,\n' +
                          '    material_id uuid,\n' +

                    Function renderLayers has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      renderLayers(): Array<any> {
                        const layers = [];
                        if (this.state?.layersData) {
                          const { layersData, highlightedObject } = this.state;
                          const { circleAttributes, lineAttributes } = layersData || {};
                    Severity: Major
                    Found in cookie-traceability/src/lib/flowmap/layers/FlowMapLayer.ts - About 2 hrs to fix

                      Function BlogPosts has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const BlogPosts: FC = () => {
                        const [slide, setSlide] = useState(1);
                        const { data, isFetched } = usePosts();
                      
                        const posts = data?.items?.slice(0, 6); // Taking the first 4 posts
                      Severity: Major
                      Found in marketing/src/containers/blog-posts/component.tsx - About 2 hrs to fix

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

                                                  <div className="flex-1">
                                                    <label htmlFor="email" className="font-bold ">
                                                      Sign up for methodology updates
                                                    </label>
                                                    <input
                        marketing/src/containers/contact/component.tsx on lines 167..181
                        marketing/src/containers/contact/component.tsx on lines 183..197
                        marketing/src/containers/contact/component.tsx on lines 201..215
                        marketing/src/containers/methodology-form/component.tsx on lines 85..99
                        marketing/src/containers/methodology-form/component.tsx on lines 101..115
                        marketing/src/containers/methodology-form/component.tsx on lines 117..131
                        marketing/src/containers/newsletter/component.tsx on lines 91..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 91.

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

                                            <div className="w-full">
                                              <label htmlFor="company" className="font-bold ">
                                                Name of company or organization
                                              </label>
                                              <input
                        Severity: Major
                        Found in marketing/src/containers/methodology-form/component.tsx and 7 other locations - About 2 hrs to fix
                        marketing/src/containers/contact/component.tsx on lines 167..181
                        marketing/src/containers/contact/component.tsx on lines 183..197
                        marketing/src/containers/contact/component.tsx on lines 201..215
                        marketing/src/containers/methodology-form/component.tsx on lines 85..99
                        marketing/src/containers/methodology-form/component.tsx on lines 101..115
                        marketing/src/containers/methodology/stay-up-to-date/component.tsx on lines 95..109
                        marketing/src/containers/newsletter/component.tsx on lines 91..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 91.

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

                                        <div className="w-full">
                                          <label htmlFor="name" className="font-bold ">
                                            First and last name
                                          </label>
                                          <input
                        Severity: Major
                        Found in marketing/src/containers/contact/component.tsx and 7 other locations - About 2 hrs to fix
                        marketing/src/containers/contact/component.tsx on lines 183..197
                        marketing/src/containers/contact/component.tsx on lines 201..215
                        marketing/src/containers/methodology-form/component.tsx on lines 85..99
                        marketing/src/containers/methodology-form/component.tsx on lines 101..115
                        marketing/src/containers/methodology-form/component.tsx on lines 117..131
                        marketing/src/containers/methodology/stay-up-to-date/component.tsx on lines 95..109
                        marketing/src/containers/newsletter/component.tsx on lines 91..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 91.

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

                                            <div className="w-full">
                                              <label htmlFor="name" className="font-bold ">
                                                Full name
                                              </label>
                                              <input
                        Severity: Major
                        Found in marketing/src/containers/methodology-form/component.tsx and 7 other locations - About 2 hrs to fix
                        marketing/src/containers/contact/component.tsx on lines 167..181
                        marketing/src/containers/contact/component.tsx on lines 183..197
                        marketing/src/containers/contact/component.tsx on lines 201..215
                        marketing/src/containers/methodology-form/component.tsx on lines 101..115
                        marketing/src/containers/methodology-form/component.tsx on lines 117..131
                        marketing/src/containers/methodology/stay-up-to-date/component.tsx on lines 95..109
                        marketing/src/containers/newsletter/component.tsx on lines 91..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 91.

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

                                        <div className="w-full">
                                          <label htmlFor="email" className="font-bold ">
                                            Sign up to our newsletter now.
                                          </label>
                                          <input
                        Severity: Major
                        Found in marketing/src/containers/newsletter/component.tsx and 7 other locations - About 2 hrs to fix
                        marketing/src/containers/contact/component.tsx on lines 167..181
                        marketing/src/containers/contact/component.tsx on lines 183..197
                        marketing/src/containers/contact/component.tsx on lines 201..215
                        marketing/src/containers/methodology-form/component.tsx on lines 85..99
                        marketing/src/containers/methodology-form/component.tsx on lines 101..115
                        marketing/src/containers/methodology-form/component.tsx on lines 117..131
                        marketing/src/containers/methodology/stay-up-to-date/component.tsx on lines 95..109

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

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

                                        <div className="w-full">
                                          <label htmlFor="email" className="font-bold ">
                                            Email address
                                          </label>
                                          <input
                        Severity: Major
                        Found in marketing/src/containers/contact/component.tsx and 7 other locations - About 2 hrs to fix
                        marketing/src/containers/contact/component.tsx on lines 167..181
                        marketing/src/containers/contact/component.tsx on lines 201..215
                        marketing/src/containers/methodology-form/component.tsx on lines 85..99
                        marketing/src/containers/methodology-form/component.tsx on lines 101..115
                        marketing/src/containers/methodology-form/component.tsx on lines 117..131
                        marketing/src/containers/methodology/stay-up-to-date/component.tsx on lines 95..109
                        marketing/src/containers/newsletter/component.tsx on lines 91..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 91.

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

                                            <div className="w-full">
                                              <label htmlFor="email" className="font-bold ">
                                                Email
                                              </label>
                                              <input
                        Severity: Major
                        Found in marketing/src/containers/methodology-form/component.tsx and 7 other locations - About 2 hrs to fix
                        marketing/src/containers/contact/component.tsx on lines 167..181
                        marketing/src/containers/contact/component.tsx on lines 183..197
                        marketing/src/containers/contact/component.tsx on lines 201..215
                        marketing/src/containers/methodology-form/component.tsx on lines 85..99
                        marketing/src/containers/methodology-form/component.tsx on lines 117..131
                        marketing/src/containers/methodology/stay-up-to-date/component.tsx on lines 95..109
                        marketing/src/containers/newsletter/component.tsx on lines 91..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 91.

                        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