HabitatMap/AirCasting

View on GitHub

Showing 667 of 667 total issues

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

  return (
    <>
      <S.DesktopCustomParameters>
        <S.Hr />
        <S.CustomParameterWrapper>
app/javascript/react/components/SessionFilters/CustomParameterFilter.tsx on lines 108..181

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

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

  return (
    <>
      <S.DesktopCustomParameters>
        <S.Hr />
        <S.CustomParameterWrapper>
app/javascript/react/components/SessionFilters/CustomSensorFilter.tsx on lines 100..173

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

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

File jquery.ui.daterangepicker.js has 1472 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// This is not the original library! The code has been customized.

/**
 * @version: 3.0.3
 * @author: Dan Grossman http://www.dangrossman.info/
Severity: Major
Found in app/javascript/jquery.ui.daterangepicker.js - About 3 days to fix

    Function Map has 733 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Map = () => {
      const dispatch = useAppDispatch();
      const {
        boundEast,
        boundNorth,
    Severity: Major
    Found in app/javascript/react/components/Map/Map.tsx - About 3 days to fix

      Function useMapParams has 632 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useMapParams = () => {
        const defaultThresholds = useAppSelector(selectDefaultThresholds);
        const thresholdValues = useAppSelector(selectThresholds);
        const isMobile: boolean = useMobileDetection();
        const [searchParams, setSearchParams] = useSearchParams();
      Severity: Major
      Found in app/javascript/react/utils/mapParamsHandler.ts - About 3 days to fix

        File Map.tsx has 830 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, {
          useCallback,
          useEffect,
          useMemo,
          useRef,
        Severity: Major
        Found in app/javascript/react/components/Map/Map.tsx - About 1 day to fix

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

          const createSessionFetchThunk = (
            type: FixedSessionsTypes,
            endpoint: (filters: string) => string
          ) => {
            return createAsyncThunk<
          Severity: Major
          Found in app/javascript/react/store/fixedSessionsSlice.ts and 1 other location - About 1 day to fix
          app/javascript/react/store/indoorSessionsSlice.ts on lines 53..92

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

          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 createSessionFetchThunk = (
            type: FixedSessionsTypes,
            endpoint: (filters: string) => string
          ) => {
            return createAsyncThunk<
          Severity: Major
          Found in app/javascript/react/store/indoorSessionsSlice.ts and 1 other location - About 1 day to fix
          app/javascript/react/store/fixedSessionsSlice.ts on lines 63..106

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

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

            var DateRangePicker = function (element, options, cb) {
              //default settings for options
              this.parentEl = "body";
              this.element = $(element);
              this.startDate = moment().startOf("day");
          Severity: Major
          Found in app/javascript/jquery.ui.daterangepicker.js - About 1 day to fix

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

            export const SensorFilter: React.FC<SensorFilterProps> = ({ isBasicOpen }) => {
              const { t } = useTranslation();
              const { sensorName } = useMapParams();
              const dispatch = useAppDispatch();
              const basicSensorsModalOpen = useAppSelector(selectBasicSensorsModalOpen);
            app/javascript/react/components/SessionFilters/ParameterFilter.tsx on lines 49..83

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

            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

            export const ParameterFilter: React.FC<ParameterFilterProps> = ({
              isBasicOpen,
            }) => {
              const { t } = useTranslation();
              const { measurementType } = useMapParams();
            app/javascript/react/components/SessionFilters/SensorFilter.tsx on lines 74..104

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

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

            const Map = () => {
              const dispatch = useAppDispatch();
              const {
                boundEast,
                boundNorth,
            Severity: Minor
            Found in app/javascript/react/components/Map/Map.tsx - About 1 day 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

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

                    clusters.forEach((cluster) => {
                      if (cluster.markers && cluster.markers.length > 1) {
                        cluster.markers.forEach((marker) => {
                          (marker as CustomMarker).clustered = true;
                        });
            Severity: Major
            Found in app/javascript/react/components/Map/Markers/FixedMarkers.tsx and 1 other location - About 1 day to fix
            app/javascript/react/components/Map/Markers/FixedMarkers.tsx on lines 159..188

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

            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

                clusters.forEach((cluster) => {
                  if (cluster.markers && cluster.markers.length > 1) {
                    cluster.markers.forEach((marker) => {
                      (marker as CustomMarker).clustered = true;
                    });
            Severity: Major
            Found in app/javascript/react/components/Map/Markers/FixedMarkers.tsx and 1 other location - About 1 day to fix
            app/javascript/react/components/Map/Markers/FixedMarkers.tsx on lines 460..489

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

            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

            File mapParamsHandler.ts has 701 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { debounce } from "lodash";
            import { useCallback, useEffect, useMemo } from "react";
            import { useSearchParams } from "react-router-dom";
            
            import { MAP_CONFIGS } from "../components/Map/mapConfigs";
            Severity: Major
            Found in app/javascript/react/utils/mapParamsHandler.ts - About 1 day to fix

              File SessionFilters.style.tsx has 652 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import styled, { keyframes } from "styled-components";
              
              import {
                acBlue,
                acBlueTransparent,

                File FixedMarkers.tsx has 629 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {
                  Cluster,
                  MarkerClusterer,
                  SuperClusterAlgorithm,
                } from "@googlemaps/markerclusterer";
                Severity: Major
                Found in app/javascript/react/components/Map/Markers/FixedMarkers.tsx - About 1 day to fix

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

                    reducers: {
                      updateFixedMeasurementExtremes(
                        state,
                        action: PayloadAction<{ min: number; max: number }>
                      ) {
                  Severity: Major
                  Found in app/javascript/react/store/fixedStreamSlice.ts and 1 other location - About 1 day to fix
                  app/javascript/react/store/mobileStreamSlice.ts on lines 78..104

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

                  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

                    reducers: {
                      updateMobileMeasurementExtremes(
                        state,
                        action: PayloadAction<{ min: number; max: number }>
                      ) {
                  Severity: Major
                  Found in app/javascript/react/store/mobileStreamSlice.ts and 1 other location - About 1 day to fix
                  app/javascript/react/store/fixedStreamSlice.ts on lines 125..150

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

                  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

                          if (this.timePicker) {
                            var hour = parseInt(
                              this.container.find(".right .hourselect").val(),
                              10
                            );
                  Severity: Major
                  Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 1 day to fix
                  app/javascript/jquery.ui.daterangepicker.js on lines 1541..1559

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

                  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