Vizzuality/landgriffon

View on GitHub
api/src/modules/eudr-alerts/eudr.controller.ts

Summary

Maintainability
C
1 day
Test Coverage

File eudr.controller.ts has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  Controller,
  Get,
  Param,
  Query,
Severity: Minor
Found in api/src/modules/eudr-alerts/eudr.controller.ts - About 2 hrs to fix

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

      @ApiOperation({
        description: 'Find all EUDR geo regions',
      })
      @ApiOkResponse({
        type: GeoRegion,
    Severity: Major
    Found in api/src/modules/eudr-alerts/eudr.controller.ts and 2 other locations - About 1 hr to fix
    api/src/modules/eudr-alerts/eudr.controller.ts on lines 120..139
    api/src/modules/eudr-alerts/eudr.controller.ts on lines 141..162

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

      @ApiOperation({
        description:
          'Find all EUDR admin regions and return them in a tree format. Data in the "children" will recursively extend for the full depth of the tree',
      })
      @ApiOkTreeResponse({
    Severity: Major
    Found in api/src/modules/eudr-alerts/eudr.controller.ts and 2 other locations - About 1 hr to fix
    api/src/modules/eudr-alerts/eudr.controller.ts on lines 120..139
    api/src/modules/eudr-alerts/eudr.controller.ts on lines 164..192

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

      @ApiOperation({
        description:
          'Find all EUDR materials and return them in a tree format. Data in the "children" will recursively extend for the full depth of the tree',
      })
      @ApiOkTreeResponse({
    Severity: Major
    Found in api/src/modules/eudr-alerts/eudr.controller.ts and 2 other locations - About 1 hr to fix
    api/src/modules/eudr-alerts/eudr.controller.ts on lines 141..162
    api/src/modules/eudr-alerts/eudr.controller.ts on lines 164..192

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

    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

      constructor(
        private readonly eudrAlertsService: EudrService,
        private readonly dashboard: EudrDashboardService,
        private readonly suppliersService: SuppliersService,
        private readonly materialsService: MaterialsService,
    Severity: Major
    Found in api/src/modules/eudr-alerts/eudr.controller.ts and 2 other locations - About 1 hr to fix
    api/src/modules/geo-coding/geo-coding.service.ts on lines 29..38
    api/src/modules/impact/base-impact.service.ts on lines 38..45

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

      @ApiOperation({
        description: 'Get a Feature List GeoRegion Ids',
      })
      @ApiOkResponse({ type: GeoFeatureResponse, isArray: true })
      @ApiUnauthorizedResponse()
    Severity: Major
    Found in api/src/modules/eudr-alerts/eudr.controller.ts and 2 other locations - About 50 mins to fix
    api/src/modules/contextual-layers/contextual-layers.controller.ts on lines 26..43
    api/src/modules/eudr-alerts/eudr.controller.ts on lines 194..211

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

      @ApiOperation({
        description: 'Get EUDR alerts dates',
      })
      @ApiOkResponse({
        type: EUDRAlertDates,
    Severity: Major
    Found in api/src/modules/eudr-alerts/eudr.controller.ts and 2 other locations - About 50 mins to fix
    api/src/modules/contextual-layers/contextual-layers.controller.ts on lines 26..43
    api/src/modules/eudr-alerts/eudr.controller.ts on lines 218..239

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

    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

      @ApiOperation({
        description: 'Get a Feature Collection by GeoRegion Ids',
      })
      @ApiOkResponse({ type: GeoFeatureCollectionResponse })
      @ApiUnauthorizedResponse()
    Severity: Major
    Found in api/src/modules/eudr-alerts/eudr.controller.ts and 3 other locations - About 35 mins to fix
    api/src/modules/contextual-layers/contextual-layers.controller.ts on lines 45..64
    api/src/modules/eudr-alerts/eudr.controller.ts on lines 120..139
    api/src/modules/suppliers/suppliers.controller.ts on lines 100..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 46.

    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

    There are no issues that match your filters.

    Category
    Status