Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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

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

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

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

const UserPasswordForm: React.FC = () => {
  const {
    register: registerPassword,
    handleSubmit: handleSubmitPassword,
    formState: { errors },
Severity: Major
Found in client/src/containers/update-password-form/component.tsx - About 3 hrs to fix

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

      async saveGeoRegionAsRadius(
        newGeoRegionValues: LocationGeoRegionDto,
      ): Promise<string> {
        const previouslyExistingGeoRegion: GeoRegion[] =
          await this.geoRegionRepository.getGeomRadiusByHashedName({
    Severity: Major
    Found in api/src/modules/geo-regions/geo-regions.service.ts and 1 other location - About 3 hrs to fix
    api/src/modules/geo-regions/geo-regions.service.ts on lines 86..98

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

    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 saveGeoRegionAsPoint(
        newGeoRegionValues: LocationGeoRegionDto,
      ): Promise<string> {
        const previouslyExistingGeoRegion: GeoRegion[] =
          await this.geoRegionRepository.getGeomPointByHashedName({
    Severity: Major
    Found in api/src/modules/geo-regions/geo-regions.service.ts and 1 other location - About 3 hrs to fix
    api/src/modules/geo-regions/geo-regions.service.ts on lines 72..84

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

    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 InterventionForm has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    const InterventionForm: React.FC<InterventionFormProps> = ({
      intervention,
      isSubmitting,
      onSubmit,
    }) => {
    Severity: Minor
    Found in client/src/containers/interventions/form/component.tsx - About 3 hrs 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 Map has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    const Map: React.FC<MapProps> = ({ ingredientId, currentTradeFlow }) => {
      const queryClient = useQueryClient();
      const [hoverInfo, setHoverInfo] = useState<any>(null);
      const { x, y, reference, floating, strategy } = useFloating({
        middleware: [flip(), offset(10)],
    Severity: Minor
    Found in cookie-traceability/src/components/map/component.tsx - About 3 hrs 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 save has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

      async save(
        importData: EudrInputShape[],
        sourcingLocationGroupId?: string,
      ): Promise<{
        sourcingLocations: SourcingLocation[];
    Severity: Minor
    Found in api/src/modules/import-data/eudr/eudr.dto-processor.service.ts - About 3 hrs 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 Features has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Features: React.FC = () => {
      return (
        <section className="relative py-12 bg-white md:py-32">
          <Wrapper>
            <div className="space-y-10 md:space-y-20">
    Severity: Major
    Found in marketing/src/containers/home/features/component.tsx - About 3 hrs to fix

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

        private async createBusinessUnitDTOFromData(
          businessUnitData: Record<string, any>,
        ): Promise<CreateBusinessUnitDto> {
          const businessUnitDto: CreateBusinessUnitDto = new CreateBusinessUnitDto();
          businessUnitDto.name = businessUnitData.name;
      api/src/modules/import-data/sourcing-data/dto-processor.service.ts on lines 298..306
      api/src/modules/import-data/sourcing-data/dto-processor.service.ts on lines 308..316

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

      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

        private async crateSuppliersDTOFromData(
          supplierData: Record<string, any>,
        ): Promise<CreateSupplierDto> {
          const suppliersDto: CreateSupplierDto = new CreateSupplierDto();
          suppliersDto.name = supplierData.name;
      api/src/modules/import-data/sourcing-data/dto-processor.service.ts on lines 288..296
      api/src/modules/import-data/sourcing-data/dto-processor.service.ts on lines 308..316

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

      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

          sendgridMail.send(msg).then(
            () => {
              res.status(200).json({ status: 'success ' });
            },
            (error) => {
      Severity: Major
      Found in marketing/src/pages/api/methodology.ts and 1 other location - About 3 hrs to fix
      marketing/src/pages/api/contact.ts on lines 32..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 96.

      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

        private async createAdminRegionDTOFromData(
          adminRegionData: Record<string, any>,
        ): Promise<CreateAdminRegionDto> {
          const adminRegionDto: CreateAdminRegionDto = new CreateAdminRegionDto();
          adminRegionDto.name = adminRegionData.name;
      api/src/modules/import-data/sourcing-data/dto-processor.service.ts on lines 288..296
      api/src/modules/import-data/sourcing-data/dto-processor.service.ts on lines 298..306

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

      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

          sendgridClient.request(request).then(
            () => {
              res.status(200).json({ status: 'success' });
            },
            (error) => {
      Severity: Major
      Found in marketing/src/pages/api/contact.ts and 1 other location - About 3 hrs to fix
      marketing/src/pages/api/methodology.ts on lines 51..60

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

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

        buildMaps(): void {
          this.soucingData.forEach((entity: Entities) => {
            const {
              supplierId,
              materialId,

        Function DataProviders has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const DataProviders: FC = () => {
          const [slide, setSlide] = useState(0);
          return (
            <section className="bg-white py-12 space-y-1 bg-cover md:space-y-64 md:py-36">
              <Wrapper>
        Severity: Major
        Found in marketing/src/containers/methodology/data-providers/component.tsx - About 3 hrs to fix

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

          import { useState, useCallback, useEffect, useMemo } from 'react';
          import DeckGL from '@deck.gl/react/typed';
          import { GeoJsonLayer } from '@deck.gl/layers/typed';
          import Map, { Source, Layer } from 'react-map-gl/maplibre';
          import { WebMercatorViewport } from '@deck.gl/core/typed';
          Severity: Minor
          Found in client/src/containers/analysis-eudr/map/component.tsx - About 3 hrs to fix

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

            export const useAdminRegionsTrees = <T = OriginRegion[]>(
              params: AdminRegionsTreesParams,
              options: UseQueryOptions<OriginRegion[], unknown, T> = {},
            ) => {
              const query = useQuery(
            Severity: Major
            Found in client/src/hooks/admin-regions/index.ts and 2 other locations - About 3 hrs to fix
            client/src/hooks/suppliers/index.ts on lines 56..74
            client/src/hooks/suppliers/index.ts on lines 76..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 95.

            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

            export const useSuppliersTypes = <T = Supplier[]>(
              params: SupplierTypesParams = { type: 't1supplier', sort: 'ASC' },
              options?: UseQueryOptions<Supplier[], unknown, T, ['suppliers', typeof params]>,
            ) => {
              const query = useQuery(
            Severity: Major
            Found in client/src/hooks/suppliers/index.ts and 2 other locations - About 3 hrs to fix
            client/src/hooks/admin-regions/index.ts on lines 56..77
            client/src/hooks/suppliers/index.ts on lines 56..74

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

            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>
                                <div className="mb-1">Suppliers</div>
                                <TreeSelect
                                  showSearch
                                  multiple
            client/src/containers/analysis-visualization/analysis-filters/more-filters/component.tsx on lines 392..404

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

            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>
                                <div className="mb-1">Producers</div>
                                <TreeSelect
                                  showSearch
                                  multiple
            client/src/containers/analysis-eudr/filters/more-filters/index.tsx on lines 250..262

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

            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