Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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

  @ApiOperation({ description: 'Updates a supplier' })
  @ApiOkResponse({ type: Supplier })
  @ApiNotFoundResponse({ description: 'Supplier not found' })
  @Patch(':id')
  async update(
Severity: Major
Found in api/src/modules/suppliers/suppliers.controller.ts and 2 other locations - About 4 hrs to fix
api/src/modules/unit-conversions/unit-conversions.controller.ts on lines 97..108
api/src/modules/units/units.controller.ts on lines 95..106

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

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

  @ApiOperation({ description: 'Updates a conversion unit' })
  @ApiOkResponse({ type: UnitConversion })
  @ApiNotFoundResponse({ description: 'Conversion unit not found' })
  @Patch(':id')
  async update(
api/src/modules/suppliers/suppliers.controller.ts on lines 142..153
api/src/modules/units/units.controller.ts on lines 95..106

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

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

  @ApiOperation({ description: 'Updates a unit' })
  @ApiOkResponse({ type: Unit })
  @ApiNotFoundResponse({ description: 'Unit not found' })
  @Patch(':id')
  async update(
Severity: Major
Found in api/src/modules/units/units.controller.ts and 2 other locations - About 4 hrs to fix
api/src/modules/suppliers/suppliers.controller.ts on lines 142..153
api/src/modules/unit-conversions/unit-conversions.controller.ts on lines 97..108

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

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

const Hero: React.FC = () => {
  const videoRef = useRef<HTMLVideoElement>();
  const [playing, setPlaying] = useState(false);

  const onTogglePlay = useCallback(() => {
Severity: Major
Found in marketing/src/containers/methodology/hero/component.tsx - About 4 hrs to fix

    Function CategoryList has 117 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const CategoryList = (): JSX.Element => {
      const {
        viewBy,
        filters: { dates, suppliers, origins, materials, plots },
        table: { filters: tableFilters },
    Severity: Major
    Found in client/src/containers/analysis-eudr/category-list/index.tsx - About 4 hrs to fix

      Function geoCodeAggregationPoint has 116 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async geoCodeAggregationPoint(sourcingData: SourcingData): Promise<any> {
          /**
           * The user must specify a country, and either an address OR coordinates
           */
          if (this.hasBothAddressAndCoordinates(sourcingData))

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

          async getTrees(
            adminRegionTreeOptions: GetAdminRegionTreeWithOptionsDto,
          ): Promise<AdminRegion[]> {
            if (adminRegionTreeOptions.withSourcingLocations) {
              if (adminRegionTreeOptions.businessUnitIds) {
        Severity: Major
        Found in api/src/modules/admin-regions/admin-regions.service.ts and 1 other location - About 4 hrs to fix
        api/src/modules/materials/materials.service.ts on lines 177..197

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

        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 getTrees(
            materialTreeOptions: GetMaterialTreeWithOptionsDto,
          ): Promise<Material[]> {
            if (materialTreeOptions.withSourcingLocations) {
              if (materialTreeOptions.originIds) {
        Severity: Major
        Found in api/src/modules/materials/materials.service.ts and 1 other location - About 4 hrs to fix
        api/src/modules/admin-regions/admin-regions.service.ts on lines 198..218

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

        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 actual-vs-scenario.service.ts has 358 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Injectable, Logger } from '@nestjs/common';
        import {
          GetActualVsScenarioImpactTableDto,
          GROUP_BY_VALUES,
          ORDER_BY,
        Severity: Minor
        Found in api/src/modules/impact/comparison/actual-vs-scenario.service.ts - About 4 hrs to fix

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

          def get_country_geometry():
              """
              Get the country geometry from a database.
              """
          
          
          data/preprocessing/default_commodity/preprocess.py on lines 13..38
          data/preprocessing/farm_ghg/preprocess_faostats.py on lines 14..39
          data/preprocessing/livestock_processed/preprocess_faostats_ha_prod.py on lines 14..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 81.

          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

          def get_country_geometry():
              """
              Get the geometry and the iso3 code from the database
              This geometry is used to spatalised the faostat data
              """
          Severity: Major
          Found in data/preprocessing/default_commodity/preprocess.py and 3 other locations - About 4 hrs to fix
          data/preprocessing/farm_ghg/preprocess_faostats.py on lines 14..39
          data/preprocessing/livestock_processed/preprocess_faostats_ha_prod.py on lines 14..40
          data/preprocessing/livestock_processed/preprocess_faostats_stocks.py on lines 22..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 81.

          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

          def get_country_geometry():
              """
              Get the geometry and the iso3 code from the database
              This geometry is used to spatalised the faostat data
              """
          Severity: Major
          Found in data/preprocessing/farm_ghg/preprocess_faostats.py and 3 other locations - About 4 hrs to fix
          data/preprocessing/default_commodity/preprocess.py on lines 13..38
          data/preprocessing/livestock_processed/preprocess_faostats_ha_prod.py on lines 14..40
          data/preprocessing/livestock_processed/preprocess_faostats_stocks.py on lines 22..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 81.

          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

          def get_country_geometry():
              """
              Get the geometry and the iso3 code from the database
              This geometry is used to spatalised the faostat data
              """
          data/preprocessing/default_commodity/preprocess.py on lines 13..38
          data/preprocessing/farm_ghg/preprocess_faostats.py on lines 14..39
          data/preprocessing/livestock_processed/preprocess_faostats_stocks.py on lines 22..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 81.

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

          const SourcingModel: React.FC = () => {
            return (
              <section className="relative py-12 space-y-12 bg-blue-600 bg-cover md:space-y-64 md:py-32">
                <Wrapper>
                  <div className="space-y-10 text-white md:space-y-20">
          Severity: Major
          Found in marketing/src/containers/methodology/sourcing-model/component.tsx - About 4 hrs to fix

            Function SignIn has 113 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const SignIn: NextPageWithLayout = () => {
              const [isLoading, setIsLoading] = useState<boolean>(false);
              const router = useRouter();
            
              const {
            Severity: Major
            Found in client/src/pages/auth/signin.tsx - About 4 hrs to fix

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

                            <ul className="list-disc pl-8 pb-1">
                              <li className="pb-3">Technical Cookies.</li>
                              <li className="pb-3">Personalization Cookies.</li>
                              <li className="pb-3">Analysis cookies.</li>
                              <li className="pb-3">Advertising cookies.</li>
              Severity: Major
              Found in marketing/src/containers/privacy-policy/component.tsx and 1 other location - About 4 hrs to fix
              marketing/src/containers/privacy-policy/component.tsx on lines 485..504

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

              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

                const deforestationLayer = new CartoLayer({
                  id: 'full-deforestation-alerts-2020-2022-hansen',
                  type: MAP_TYPES.QUERY,
                  connection: 'eudr',
                  data: 'SELECT * FROM `cartobq.eudr.TCL_hansen_year` WHERE year<=?',
              Severity: Major
              Found in client/src/containers/analysis-eudr/map/compare.tsx and 1 other location - About 4 hrs to fix
              client/src/containers/analysis-eudr/map/component.tsx on lines 177..193

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

              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

              const SelectScrollUpButton = React.forwardRef<
                React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
                React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
              >(({ className, ...props }, ref) => (
                <SelectPrimitive.ScrollUpButton
              Severity: Major
              Found in client/src/components/ui/select.tsx and 1 other location - About 4 hrs to fix
              client/src/components/ui/select.tsx on lines 56..67

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

              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

              const SelectScrollDownButton = React.forwardRef<
                React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
                React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
              >(({ className, ...props }, ref) => (
                <SelectPrimitive.ScrollDownButton
              Severity: Major
              Found in client/src/components/ui/select.tsx and 1 other location - About 4 hrs to fix
              client/src/components/ui/select.tsx on lines 42..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 125.

              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

                const deforestationLayer = new CartoLayer({
                  id: 'full-deforestation-alerts-2020-2022-hansen',
                  type: MAP_TYPES.QUERY,
                  connection: 'eudr',
                  data: 'SELECT * FROM `cartobq.eudr.TCL_hansen_year` WHERE year<=?',
              Severity: Major
              Found in client/src/containers/analysis-eudr/map/component.tsx and 1 other location - About 4 hrs to fix
              client/src/containers/analysis-eudr/map/compare.tsx on lines 182..198

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

              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