Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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

export class UnitsService extends AppBaseService<
  Unit,
  CreateUnitDto,
  UpdateUnitDto,
  AppInfoDTO
Severity: Major
Found in api/src/modules/units/units.service.ts and 1 other location - About 1 day to fix
api/src/modules/unit-conversions/unit-conversions.service.ts on lines 16..51

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

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 class UnitConversionsService extends AppBaseService<
  UnitConversion,
  CreateUnitConversionDto,
  UpdateUnitConversionDto,
  AppInfoDTO
Severity: Major
Found in api/src/modules/unit-conversions/unit-conversions.service.ts and 1 other location - About 1 day to fix
api/src/modules/units/units.service.ts on lines 13..41

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

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

const SupplierSourcingInfoChart = (): JSX.Element => {
  const [showBy, setShowBy] = useState<'byVolume' | 'byArea'>('byVolume');
  const [selectedPlots, setSelectedPlots] = useState<string[]>([]);
  const { supplierId }: { supplierId: string } = useParams();
  const {

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

                              <div>
                                <label className={LABEL_CLASSNAMES}>Tier 1 supplier</label>
                                <Controller
                                  name="newT1SupplierId"
                                  control={control}
    Severity: Major
    Found in client/src/containers/interventions/form/component.tsx and 1 other location - About 1 day to fix
    client/src/containers/interventions/form/component.tsx on lines 985..1010

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

    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

                              <div>
                                <label className={LABEL_CLASSNAMES}>Producer</label>
                                <Controller
                                  name="newProducerId"
                                  control={control}
    Severity: Major
    Found in client/src/containers/interventions/form/component.tsx and 1 other location - About 1 day to fix
    client/src/containers/interventions/form/component.tsx on lines 959..984

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

    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

              <div className="flex flex-wrap gap-2">
                {plotConfig.map(({ name, color }) => (
                  <Badge
                    key={name}
                    variant="secondary"
    client/src/containers/analysis-eudr-detail/sourcing-info/chart/index.tsx on lines 144..173

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

    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 currentOptions = useMemo<TreeSelectProps<IsMulti>['current']>(() => {
        if (!multiple) return current;
        const checkedOptions: TreeSelectOption[] = [];
    
        (current as TreeSelectOption[])?.forEach((key) => {
    Severity: Major
    Found in client/src/containers/locations/select/component.tsx and 1 other location - About 1 day to fix
    client/src/containers/suppliers/select/component.tsx on lines 59..73

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

    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

              <div className="flex flex-wrap gap-2">
                {plotConfig.map(({ name, color }) => (
                  <Badge
                    key={name}
                    variant="secondary"
    client/src/containers/analysis-eudr-detail/deforestation-alerts/chart/index.tsx on lines 110..139

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

    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 currentOptions = useMemo<TreeSelectProps<IsMulti>['current']>(() => {
        if (!multiple) return current;
        const checkedOptions: TreeSelectOption[] = [];
    
        (current as TreeSelectOption[])?.forEach((key) => {
    Severity: Major
    Found in client/src/containers/suppliers/select/component.tsx and 1 other location - About 1 day to fix
    client/src/containers/locations/select/component.tsx on lines 69..83

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

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

    const AdminDataPage: React.FC = () => {
      const { push, query } = useRouter();
      const [sorting, setSorting] = useState<SortingState>([]);
      const { data: session } = useSession();
      const { data: task } = useLasTask();
    Severity: Major
    Found in client/src/containers/admin/data-table/index.tsx - About 1 day to fix

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

          if len(unit_list) == 1 and unit_list[0] in units_to_tonnes:
              unit = unit_list[0]
              conversion = units_to_tonnes[unit]
          else:
              # Check which units from the dataframe exist in the conversion dictionary
      Severity: Major
      Found in data/preprocessing/farm_ghg/preprocess_faostats.py and 1 other location - About 1 day to fix
      data/preprocessing/livestock_processed/preprocess_faostats_ha_prod.py on lines 54..65

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

      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

          if len(unit_list) == 1 and unit_list[0] in units_to_tonnes:
              unit = unit_list[0]
              conversion = units_to_tonnes[unit]
          else:
              # Check which units from the dataframe exist in the conversion dictionary
      data/preprocessing/farm_ghg/preprocess_faostats.py on lines 53..64

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

      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 index.tsx has 506 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { useCallback, useEffect, useMemo, useState } from 'react';
      import { DownloadIcon, InformationCircleIcon } from '@heroicons/react/outline';
      import { uniq, omit } from 'lodash-es';
      import toast from 'react-hot-toast';
      import { ArrowLeftIcon } from '@heroicons/react/solid';
      Severity: Major
      Found in client/src/containers/analysis-visualization/analysis-table/index.tsx - About 1 day to fix

        Function InnerTreeSelect has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
        Open

        const InnerTreeSelect = <IsMulti extends boolean>(
          {
            current: currentRaw,
            loading,
            maxBadges = 5,
        Severity: Minor
        Found in client/src/components/tree-select/component.tsx - About 1 day to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function UpdateScenarioPage has 198 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const UpdateScenarioPage: React.FC = () => {
          const { query } = useRouter();
          const queryClient = useQueryClient();
          const { data, isLoading } = useScenario(query?.scenarioId as string, { include: 'user' });
          const updateScenario = useUpdateScenario();
        Severity: Major
        Found in client/src/pages/data/scenarios/[scenarioId]/edit.tsx - About 7 hrs to fix

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

          const PalmOilIcon: React.FC<React.HTMLAttributes<SVGElement>> = ({
            className = 'fill-secondary',
          }) => (
            <svg
              width="18"
          cookie-traceability/src/components/icons/wheat/component.tsx on lines 1..27

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

          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 WheatIcon: React.FC<React.HTMLAttributes<SVGElement>> = ({
            className = 'fill-secondary',
          }) => (
            <svg
              width="18"
          Severity: Major
          Found in cookie-traceability/src/components/icons/wheat/component.tsx and 1 other location - About 7 hrs to fix
          cookie-traceability/src/components/icons/palm-oil/component.tsx on lines 1..27

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

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

          const ScenariosAdminPage: React.FC = () => {
            const router = useRouter();
            const { query } = router;
          
            const [scenatioToDelete, setScenatioToDelete] = useState<string>(null);
          Severity: Major
          Found in client/src/pages/data/scenarios/index.tsx - About 7 hrs to fix

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

              @ApiOperation({
                description:
                  'Get a Scenario Vs Scenario Impact Table CSV Report for 2 Scenarios',
              })
              @CheckUserOwnsScenario({
            Severity: Major
            Found in api/src/modules/impact/impact-report.controller.ts and 1 other location - About 7 hrs to fix
            api/src/modules/impact/impact-report.controller.ts on lines 56..85

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

            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

              @ApiOperation({
                description:
                  'Get a Actual Vs Scenario Impact Table CSV Report for a given scenario',
              })
              @CheckUserOwnsScenario({
            Severity: Major
            Found in api/src/modules/impact/impact-report.controller.ts and 1 other location - About 7 hrs to fix
            api/src/modules/impact/impact-report.controller.ts on lines 87..116

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

            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