Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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

  @ApiOperation({ description: 'Deletes a supplier' })
  @ApiOkResponse()
  @ApiNotFoundResponse({ description: 'Supplier not found' })
  @Delete(':id')
  async delete(@Param('id') id: string): Promise<void> {
Severity: Major
Found in api/src/modules/suppliers/suppliers.controller.ts and 6 other locations - About 2 hrs to fix
api/src/modules/scenario-interventions/scenario-interventions.controller.ts on lines 124..130
api/src/modules/sourcing-location-groups/sourcing-location-groups.controller.ts on lines 123..129
api/src/modules/sourcing-records/sourcing-records.controller.ts on lines 147..153
api/src/modules/unit-conversions/unit-conversions.controller.ts on lines 110..116
api/src/modules/units/units.controller.ts on lines 108..114
api/src/modules/url-params/url-params.controller.ts on lines 46..52

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

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 7 locations. Consider refactoring.
Open

  @ApiOperation({ description: 'Deletes a sourcing record' })
  @ApiOkResponse()
  @ApiNotFoundResponse({ description: 'Sourcing record not found' })
  @Delete(':id')
  async delete(@Param('id') id: string): Promise<void> {
api/src/modules/scenario-interventions/scenario-interventions.controller.ts on lines 124..130
api/src/modules/sourcing-location-groups/sourcing-location-groups.controller.ts on lines 123..129
api/src/modules/suppliers/suppliers.controller.ts on lines 155..161
api/src/modules/unit-conversions/unit-conversions.controller.ts on lines 110..116
api/src/modules/units/units.controller.ts on lines 108..114
api/src/modules/url-params/url-params.controller.ts on lines 46..52

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

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 7 locations. Consider refactoring.
Open

  @ApiOperation({ description: 'Deletes a conversion unit' })
  @ApiOkResponse()
  @ApiNotFoundResponse({ description: 'Conversion unit not found' })
  @Delete(':id')
  async delete(@Param('id') id: string): Promise<void> {
api/src/modules/scenario-interventions/scenario-interventions.controller.ts on lines 124..130
api/src/modules/sourcing-location-groups/sourcing-location-groups.controller.ts on lines 123..129
api/src/modules/sourcing-records/sourcing-records.controller.ts on lines 147..153
api/src/modules/suppliers/suppliers.controller.ts on lines 155..161
api/src/modules/units/units.controller.ts on lines 108..114
api/src/modules/url-params/url-params.controller.ts on lines 46..52

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

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 7 locations. Consider refactoring.
Open

  @ApiOperation({ description: 'Deletes a set of URL Params' })
  @ApiOkResponse()
  @ApiNotFoundResponse({ description: 'URL Params not found' })
  @Delete(':id')
  async delete(@Param('id') id: string): Promise<void> {
Severity: Major
Found in api/src/modules/url-params/url-params.controller.ts and 6 other locations - About 2 hrs to fix
api/src/modules/scenario-interventions/scenario-interventions.controller.ts on lines 124..130
api/src/modules/sourcing-location-groups/sourcing-location-groups.controller.ts on lines 123..129
api/src/modules/sourcing-records/sourcing-records.controller.ts on lines 147..153
api/src/modules/suppliers/suppliers.controller.ts on lines 155..161
api/src/modules/unit-conversions/unit-conversions.controller.ts on lines 110..116
api/src/modules/units/units.controller.ts on lines 108..114

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

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 7 locations. Consider refactoring.
Open

  @ApiOperation({ description: 'Deletes a unit' })
  @ApiOkResponse()
  @ApiNotFoundResponse({ description: 'Unit not found' })
  @Delete(':id')
  async delete(@Param('id') id: string): Promise<void> {
Severity: Major
Found in api/src/modules/units/units.controller.ts and 6 other locations - About 2 hrs to fix
api/src/modules/scenario-interventions/scenario-interventions.controller.ts on lines 124..130
api/src/modules/sourcing-location-groups/sourcing-location-groups.controller.ts on lines 123..129
api/src/modules/sourcing-records/sourcing-records.controller.ts on lines 147..153
api/src/modules/suppliers/suppliers.controller.ts on lines 155..161
api/src/modules/unit-conversions/unit-conversions.controller.ts on lines 110..116
api/src/modules/url-params/url-params.controller.ts on lines 46..52

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

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

const MapPage: NextPageWithLayout = () => {
  const scrollRef = useRef<HTMLDivElement>(null);
  const [isCollapsed, setIsCollapsed] = useState(false);
  const { planetCompareLayer } = useAppSelector((state) => state.eudr);
  const {
Severity: Major
Found in client/src/pages/eudr/suppliers/[supplierId].tsx - About 2 hrs to fix

    Function YearsRange has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const YearsRange: React.FC = () => {
      const dispatch = useAppDispatch();
    
      const [years, setYears] = useState<number[]>([]);
      const { visualizationMode } = useAppSelector(analysisUI);

      Function createIndicatorRecordsBySourcingRecords has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async createIndicatorRecordsBySourcingRecords(
          sourcingData: {
            sourcingRecordId: string;
            geoRegionId: string;
            materialId: string;

        Function addFilters has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static addFilters<Entity extends ObjectLiteral>(
            queryBuilder: SelectQueryBuilder<Entity>,
            filters: CommonFiltersDto,
          ): SelectQueryBuilder<Entity> {
            if (filters.materialIds) {
        Severity: Major
        Found in api/src/utils/base.query-builder.ts - About 2 hrs to fix

          Function _getModel has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _getModel(gl: WebGLRenderingContext): Record<string, any> {
              let positions: number[] = [];
              let pixelOffsets: number[] = [];
          
              const { drawOutline, outlineThickness } = this.props;

            Function renderLayers has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

              renderLayers(): Array<any> {
                const layers = [];
                if (this.state?.layersData) {
                  const { layersData, highlightedObject } = this.state;
                  const { circleAttributes, lineAttributes } = layersData || {};
            Severity: Minor
            Found in cookie-traceability/src/lib/flowmap/layers/FlowMapLayer.ts - About 2 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 baseGetImpactMap has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private async baseGetImpactMap(
                baseImpactMap: BaseImpactMap,
              ): Promise<{ impactMap: H3IndexValueData[]; quantiles: number[] }> {
                let baseMapQuery: SelectQueryBuilder<any> = this.baseMapQuery(
                  baseImpactMap.indicatorId,
            Severity: Major
            Found in api/src/modules/h3-data/h3-data.repository.ts - About 2 hrs to fix

              Function Testimonials has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Testimonials: React.FC = () => {
                const [slide, setSlide] = useState(0);
              
                return (
                  <section className="relative py-12 bg-blue-600 md:py-32">
              Severity: Major
              Found in marketing/src/containers/testimonials/component.tsx - About 2 hrs to fix

                Function Snow has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function Snow() {
                  const pointsRef = useRef<Points>(null);
                
                  const { viewport } = useThree();
                
                
                Severity: Major
                Found in cookie-traceability/src/components/snow/component.tsx - About 2 hrs to fix

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

                    private getYearAbsoluteDifference(
                      row: ScenarioVsScenarioImpactTableRows,
                      year: number,
                    ): number {
                      const yearValue: ScenarioVsScenarioImpactTableRowsValues | undefined =
                  api/src/modules/impact/comparison/actual-vs-scenario.service.ts on lines 410..420
                  api/src/modules/impact/impact.service.ts on lines 479..485

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

                  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 getYearAbsoluteDifference(
                      row: ActualVsScenarioImpactTableRows,
                      year: number,
                    ): number {
                      const yearValue: ActualVsScenarioImpactTableRowsValues | undefined =
                  api/src/modules/impact/comparison/scenario-vs-scenario.service.ts on lines 504..514
                  api/src/modules/impact/impact.service.ts on lines 479..485

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

                  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

                            <Button
                              variant="outline"
                              className="h-8 w-8 border-0 p-0"
                              onClick={() => table.nextPage()}
                              disabled={!table.getCanNextPage()}
                  client/src/containers/analysis-eudr/supplier-list-table/table/pagination.tsx on lines 63..71

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

                  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

                      } else if (
                        ((args.object as SourcingDataExcelValidator).location_type ===
                          LOCATION_TYPES.PRODUCTION_AGGREGATION_POINT ||
                          (args.object as SourcingDataExcelValidator).location_type ===
                            LOCATION_TYPES.POINT_OF_PRODUCTION) &&
                  api/src/modules/import-data/sourcing-data/validation/validators/address-input.custom.validator.ts on lines 54..69

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

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

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

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

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

                  Refactorings

                  Further Reading

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

                    @ApiOperation({ description: 'Deletes a task' })
                    @ApiNotFoundResponse({ description: 'Task not found' })
                    @ApiOkResponse()
                    @Delete(':id')
                    async delete(@Param('id') id: string): Promise<void> {
                  Severity: Major
                  Found in api/src/modules/tasks/tasks.controller.ts and 1 other location - About 2 hrs to fix
                  api/src/modules/targets/targets.controller.ts on lines 103..109

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

                  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

                    variant: {
                      primary: {
                        default: 'bg-navy-400 text-white hover:shadow-md hover:bg-navy-600 focus:ring-navy-400/20',
                        danger: 'bg-red-400 text-white hover:shadow-md hover:bg-red-800 focus:ring-red-400/20',
                        disabled: 'opacity-50',
                  Severity: Major
                  Found in client/src/components/button/component.tsx and 1 other location - About 2 hrs to fix
                  client/src/containers/toaster/component.tsx on lines 7..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 86.

                  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