Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

Function querySyncMiddleware has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const querySyncMiddleware: Middleware = () => (next) => (action) => {
  const { query, isReady } = router;
  if (!isReady) return next(action);

  Object.entries(QUERY_PARAMS_MAP).forEach(async ([param, queryState]) => {
Severity: Minor
Found in client/src/store/index.ts - About 1 hr to fix

    Function useSourcingLocationsMaterials has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function useSourcingLocationsMaterials(
      params: SourcingLocationsParams,
      queryOptions?: UseQueryOptions<SourcingLocationsMaterialsAPIResponse>,
    ): SourcingLocationsMaterialsDataResponse {
      const query = useQuery<SourcingLocationsMaterialsAPIResponse>(
    Severity: Minor
    Found in client/src/hooks/sourcing-locations/index.ts - About 1 hr to fix

      Function catch has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        catch(exception: Error, host: ArgumentsHost): void {
          const ctx: HttpArgumentsHost = host.switchToHttp();
          const response: any = ctx.getResponse();
          const request: any = ctx.getRequest();
      
      
      Severity: Minor
      Found in api/src/filters/all-exceptions.exception.filter.ts - About 1 hr to fix

        Function getMaterialMapByResolution has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async getMaterialMapByResolution(
            materialH3Data: H3Data,
            resolution: number,
          ): Promise<{ materialMap: H3IndexValueData[]; quantiles: number[] }> {
            const tmpTableName: string = H3DataRepository.generateRandomTableName();
        Severity: Minor
        Found in api/src/modules/h3-data/h3-data.repository.ts - About 1 hr to fix

          Function updateImportTask has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async updateImportTask(updateTask: UpdateImportTask): Promise<Task> {
              /**
               * @debt
               * TypeORM does not provide a friendly API to handle json fields on a UPDATE statement
               * For now we are retrieving the event, update data withing the API and save it back
          Severity: Minor
          Found in api/src/modules/tasks/tasks.service.ts - About 1 hr to fix

            Function AboutPage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const AboutPage: NextPage<PageProps> = () => {
              return (
                <ApplicationLayout>
                  <>
                    <Head>
            Severity: Minor
            Found in marketing/src/pages/about.tsx - About 1 hr to fix

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

                      <div className="flex grow flex-col rounded-[20px] bg-gray-50 p-5 text-gray-900">
                        <h4 className="text-2xs uppercase">Commodity sourced from plot</h4>
                        <span>{data?.materialName || '-'}</span>
                      </div>
              client/src/containers/analysis-eudr-detail/sourcing-info/index.tsx on lines 34..37
              client/src/containers/analysis-eudr-detail/supplier-info/index.tsx on lines 21..24
              client/src/containers/analysis-eudr-detail/supplier-info/index.tsx on lines 25..28

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

              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

                      <div className="flex grow flex-col rounded-[20px] bg-gray-50 p-5 text-gray-900">
                        <h4 className="text-2xs uppercase">Address</h4>
                        <span>{data?.address || '-'}</span>
                      </div>
              client/src/containers/analysis-eudr-detail/sourcing-info/index.tsx on lines 34..37
              client/src/containers/analysis-eudr-detail/sourcing-info/index.tsx on lines 38..41
              client/src/containers/analysis-eudr-detail/supplier-info/index.tsx on lines 21..24

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

              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

                  if (this.dto?.supplierIds) {
                    this.queryBuilder.andWhere(
                      `${EUDRAlertsFields.supplierId} IN (:...supplierIds)`,
                      {
                        supplierIds: this.dto.supplierIds,
              api/src/modules/eudr-alerts/alerts-query-builder/big-query-alerts-query.builder.ts on lines 80..87
              api/src/modules/eudr-alerts/alerts-query-builder/big-query-alerts-query.builder.ts on lines 88..95

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

              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

                      <div className="flex flex-col rounded-[20px] bg-gray-50 p-5 text-gray-900">
                        <h4 className="text-2xs uppercase">Supplier ID</h4>
                        <span>{data?.companyId || '-'}</span>
                      </div>
              client/src/containers/analysis-eudr-detail/sourcing-info/index.tsx on lines 34..37
              client/src/containers/analysis-eudr-detail/sourcing-info/index.tsx on lines 38..41
              client/src/containers/analysis-eudr-detail/supplier-info/index.tsx on lines 25..28

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

              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

                      <div className="flex flex-col rounded-[20px] bg-gray-50 p-5 text-gray-900">
                        <h4 className="text-2xs uppercase">HS code</h4>
                        <span>{data?.hsCode || '-'}</span>
                      </div>
              client/src/containers/analysis-eudr-detail/sourcing-info/index.tsx on lines 38..41
              client/src/containers/analysis-eudr-detail/supplier-info/index.tsx on lines 21..24
              client/src/containers/analysis-eudr-detail/supplier-info/index.tsx on lines 25..28

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

              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

                  if (this.dto?.alertConfidence) {
                    this.queryBuilder.andWhere(
                      `${EUDR_ALERTS_DATABASE_FIELDS.alertConfidence} = :alertConfidence`,
                      {
                        alertConfidence: this.dto.alertConfidence,
              api/src/modules/eudr-alerts/alerts-query-builder/big-query-alerts-query.builder.ts on lines 72..79
              api/src/modules/eudr-alerts/alerts-query-builder/big-query-alerts-query.builder.ts on lines 80..87

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

              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 (result.length > 0) {
                    Object.keys(result[0]).forEach((key) => key !== 'date' && keys.push(key));
                  }
              client/src/containers/analysis-chart/impact-chart/component.tsx on lines 183..185

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

              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

                  if (this.dto?.geoRegionIds) {
                    this.queryBuilder.andWhere(
                      `${EUDRAlertsFields.geoRegionId} IN (:...geoRegionIds)`,
                      {
                        geoRegionIds: this.dto.geoRegionIds,
              api/src/modules/eudr-alerts/alerts-query-builder/big-query-alerts-query.builder.ts on lines 72..79
              api/src/modules/eudr-alerts/alerts-query-builder/big-query-alerts-query.builder.ts on lines 88..95

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

              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 (result.length > 0) {
                    Object.keys(result[0]).forEach((key) => key !== 'date' && keys.push(key));
                  }
              client/src/containers/analysis-chart/impact-chart/component.tsx on lines 99..101

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

              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

                  setFilters: (state, action: PayloadAction<Partial<EUDRState['filters']>>) => ({
                    ...state,
                    filters: {
                      ...state.filters,
                      ...action.payload,
              Severity: Major
              Found in client/src/store/features/eudr/index.ts and 1 other location - About 1 hr to fix
              client/src/store/features/eudr-detail/index.ts on lines 30..36

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

              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 geoRegionId: string =
                      await this.geoRegionService.saveGeoRegionAsRadius({
                        name: sourcingData.locationCountryInput,
                        coordinates: {
                          lng: sourcingData.locationLongitude,
              api/src/modules/geo-coding/strategies/point-of-production.geocoding.service.ts on lines 21..28

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

              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 optionsProducers = useMemo<Option[]>(
                  () =>
                    producers?.map((producer) => ({
                      label: producer.name,
                      value: producer.id,
              Severity: Major
              Found in client/src/containers/interventions/form/component.tsx and 1 other location - About 1 hr to fix
              client/src/containers/interventions/form/component.tsx on lines 81..88

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 58.

              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

                  setFilters: (state, action: PayloadAction<Partial<EUDRDetailState['filters']>>) => ({
                    ...state,
                    filters: {
                      ...state.filters,
                      ...action.payload,
              Severity: Major
              Found in client/src/store/features/eudr-detail/index.ts and 1 other location - About 1 hr to fix
              client/src/store/features/eudr/index.ts on lines 114..120

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

              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 optionsSuppliers = useMemo<Option[]>(
                  () =>
                    suppliers?.map((supplier) => ({
                      label: supplier.name,
                      value: supplier.id,
              Severity: Major
              Found in client/src/containers/interventions/form/component.tsx and 1 other location - About 1 hr to fix
              client/src/containers/interventions/form/component.tsx on lines 94..101

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

              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