Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

Function importSourcingData has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async importSourcingData(filePath: string, taskId: string): Promise<any> {
    this.logger.log(`Starting import process`);
    await this.fileService.isFilePresentInFs(filePath);
    try {
      const parsedXLSXDataset: SourcingRecordsSheets =

    Function What has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const What: React.FC = () => {
      const [slide, setSlide] = useState(0);
    
      const DESCRIPTION = useMemo(() => {
        return SLIDES[slide]?.description;
    Severity: Major
    Found in marketing/src/containers/home/what/component.tsx - About 3 hrs to fix

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

        it('a user without authorship or permission can not edit a scenario', () => {
          cy.intercept('api/v1/users/me', { fixture: 'profiles/no-permissions' }).as('profile');
          cy.wait('@profile');
          cy.wait('@fetchScenarioInterventions');
          cy.wait('@scenariosNoPaginated');
      Severity: Major
      Found in client/cypress/e2e/scenarios.cy.ts and 1 other location - About 3 hrs to fix
      client/cypress/e2e/scenarios.cy.ts on lines 113..122

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

      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

        it('a user without authorship or permission can not remove a scenario', () => {
          cy.intercept('api/v1/users/me', { fixture: 'profiles/no-permissions' }).as('profile');
          cy.wait('@profile');
          cy.wait('@fetchScenarioInterventions');
          cy.wait('@scenariosNoPaginated');
      Severity: Major
      Found in client/cypress/e2e/scenarios.cy.ts and 1 other location - About 3 hrs to fix
      client/cypress/e2e/scenarios.cy.ts on lines 136..145

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

      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

      function latY(lat: number) {
        const sin = Math.sin((lat * Math.PI) / 180);
        const y = 0.5 - (0.25 * Math.log((1 + sin) / (1 - sin))) / Math.PI;
        return y < 0 ? 0 : y > 1 ? 1 : y;
      }
      Severity: Major
      Found in cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.ts and 1 other location - About 3 hrs to fix
      cookie-traceability/src/lib/flowmap/data/cluster/cluster.ts on lines 273..277

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

      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

      function latY(lat: number) {
        const sin = Math.sin((lat * Math.PI) / 180);
        const y = 0.5 - (0.25 * Math.log((1 + sin) / (1 - sin))) / Math.PI;
        return y < 0 ? 0 : y > 1 ? 1 : y;
      }
      Severity: Major
      Found in cookie-traceability/src/lib/flowmap/data/cluster/cluster.ts and 1 other location - About 3 hrs to fix
      cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.ts on lines 1122..1126

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

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

      const IndicatorsMapFilter = () => {
        const [value, setValue] = useState<string | undefined>(undefined);
        const [syncedIndicators, setSyncedIndicators] = useSyncIndicators();
      
        const { data, isFetching, isFetched } = useIndicators(

        Function prepareLayersData has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          prepareLayersData(state: FlowMapState, props: FlowMapData<L, F>): LayersData {
            const locations = this.getLocationsForFlowMapLayer(state, props) || [];
            const flows = this.getFlowsForFlowMapLayer(state, props) || [];
            const { getFlowOriginId, getFlowDestId, getFlowMagnitude, getLocationId, getLocationCentroid } =
              this.accessors;
        Severity: Major
        Found in cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.ts - About 3 hrs to fix

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

                      <li>
                        <FadeIn className="space-y-5 md:space-y-10">
                          <div className="space-y-5">
                            <Icon icon={ENTERPRISE_SVG} className="w-14 h-14" />
                            <h3 className="text-3xl font-medium font-display">Compliance and beyond.</h3>
          Severity: Major
          Found in marketing/src/containers/home/features/component.tsx and 2 other locations - About 3 hrs to fix
          marketing/src/containers/home/features/component.tsx on lines 38..51
          marketing/src/containers/home/features/component.tsx on lines 52..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 104.

          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

                      <li>
                        <FadeIn className="space-y-5 md:space-y-10">
                          <div className="space-y-5">
                            <Icon icon={PICTURE_SVG} className="w-14 h-14" />
                            <h3 className="text-3xl font-medium font-display">See the big picture.</h3>
          Severity: Major
          Found in marketing/src/containers/home/features/component.tsx and 2 other locations - About 3 hrs to fix
          marketing/src/containers/home/features/component.tsx on lines 26..37
          marketing/src/containers/home/features/component.tsx on lines 52..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 104.

          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

            @ApiPropertyOptional({
              description: 'Types of Sourcing Locations, written with hyphens',
              enum: Object.values(LOCATION_TYPES),
              name: 'locationTypes[]',
            })
          Severity: Major
          Found in api/src/utils/base.query-builder.ts and 2 other locations - About 3 hrs to fix
          api/src/modules/h3-data/dto/get-impact-map.dto.ts on lines 68..81
          api/src/modules/suppliers/dto/get-supplier-tree-with-options.dto.ts on lines 52..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 104.

          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

                      <li>
                        <FadeIn className="space-y-5 md:space-y-10">
                          <div className="space-y-5">
                            <Icon icon={SCIENCE_SVG} className="w-14 h-14" />
                            <h3 className="text-3xl font-medium font-display">
          Severity: Major
          Found in marketing/src/containers/home/features/component.tsx and 2 other locations - About 3 hrs to fix
          marketing/src/containers/home/features/component.tsx on lines 26..37
          marketing/src/containers/home/features/component.tsx on lines 38..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 104.

          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

            @ApiPropertyOptional({
              description: 'Types of Sourcing Locations, written with hyphens',
              enum: Object.values(LOCATION_TYPES),
              name: 'locationTypes[]',
            })
          Severity: Major
          Found in api/src/modules/h3-data/dto/get-impact-map.dto.ts and 2 other locations - About 3 hrs to fix
          api/src/modules/suppliers/dto/get-supplier-tree-with-options.dto.ts on lines 52..65
          api/src/utils/base.query-builder.ts on lines 122..135

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 104.

          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

            @ApiPropertyOptional({
              description: 'Types of Sourcing Locations, written with hyphens',
              enum: Object.values(LOCATION_TYPES),
              name: 'locationTypes[]',
            })
          api/src/modules/h3-data/dto/get-impact-map.dto.ts on lines 68..81
          api/src/utils/base.query-builder.ts on lines 122..135

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 104.

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

          const StackedAreaChart: React.FC<StackedAreaChartProps> = ({ indicator }) => {
            const [legendKey, setLegendKey] = useState<string | null>(null);
          
            const filters = useAppSelector(filtersForTabularAPI);
            const { currentScenario: scenarioId } = useAppSelector(scenarios);
          Severity: Minor
          Found in client/src/containers/analysis-chart/impact-chart/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 geoCodePointOfProduction has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async geoCodePointOfProduction(sourcingData: SourcingData): Promise<any> {
              if (!sourcingData.locationCountryInput)
                throw new Error(
                  'A country must be provided for Point of Production location type',
                );

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

                    const { adminRegionId, geoRegionId } =
                      await this.adminRegionService.getAdminRegionIdByCoordinatesAndLevel(
                        {
                          lng: geocodedResponseData?.data.results[0]?.geometry.location.lng,
                          lat: geocodedResponseData?.data.results[0]?.geometry.location.lat,
            api/src/modules/geo-coding/strategies/aggregation-point.geocoding.service.ts on lines 113..123

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

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

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

            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 ButterIcon: React.FC<React.HTMLAttributes<SVGElement>> = ({
              className = 'fill-secondary',
            }) => (
              <svg
                width="22"
            cookie-traceability/src/components/icons/cocoa/component.tsx on lines 1..14

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

            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 { adminRegionId, geoRegionId } =
                      await this.adminRegionService.getAdminRegionIdByCoordinatesAndLevel(
                        {
                          lng: geocodedResponseData?.data?.results[0]?.geometry.location
                            .lng,
            api/src/modules/geo-coding/strategies/aggregation-point.geocoding.service.ts on lines 95..103

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

            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