HabitatMap/AirCasting

View on GitHub

Showing 239 of 667 total issues

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

export const heat = (params) => {
  var Heat = function () {};

  Heat.prototype = {
    getValue: function (name) {
Severity: Major
Found in app/javascript/javascript/heat.js - About 2 hrs to fix

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

        clickDate: function (e) {
          if (!$(e.target).hasClass("available")) return;
    
          var title = $(e.target).attr("data-title");
          var row = title.substr(1, 1);
    Severity: Major
    Found in app/javascript/jquery.ui.daterangepicker.js - About 2 hrs to fix

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

      const setupHeatMap = () => {
        const node = document.getElementById("heatmap");
        if (!node) {
          setTimeout(setupHeatMap, 100);
        } else {
      Severity: Major
      Found in app/javascript/packs/elm.js - About 2 hrs to fix

        Function updateMarkerOverlays has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const updateMarkerOverlays = useCallback(() => {
            markerRefs.current.forEach((marker, streamId) => {
              const isSelected =
                marker.userData?.streamId === selectedStreamId?.toString();
              const shouldPulse =
        Severity: Major
        Found in app/javascript/react/components/Map/Markers/FixedMarkers.tsx - About 2 hrs to fix

          Class Session has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Session < ApplicationRecord
            self.skip_time_zone_conversion_for_attributes = %i[
              start_time_local
              end_time_local
            ]
          Severity: Minor
          Found in app/models/session.rb - About 2 hrs to fix

            Function DesktopParameterFilter has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const DesktopParameterFilter = () => {
              const [isBasicOpen, setIsBasicOpen] = useState(false);
              const [moreOpen, setMoreOpen] = useState(false);
              const { t } = useTranslation();
              const { measurementType, sessionType, setParameterParams } = useMapParams();
            Severity: Major
            Found in app/javascript/react/components/SessionFilters/ParameterFilter.tsx - About 2 hrs to fix

              Function heat has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

              export const heat = (params) => {
                var Heat = function () {};
              
                Heat.prototype = {
                  getValue: function (name) {
              Severity: Minor
              Found in app/javascript/javascript/heat.js - 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

              Consider simplifying this complex logical expression.
              Open

                  if (
                    west === undefined ||
                    east === undefined ||
                    south === undefined ||
                    north === undefined ||
              Severity: Critical
              Found in app/javascript/react/api/apiEndpoints.ts - About 2 hrs to fix

                Function getXAxisOptions has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const getXAxisOptions = (
                  isMobile: boolean,
                  rangeDisplayRef: React.RefObject<HTMLDivElement> | undefined,
                  fixedSessionTypeSelected: boolean,
                  isIndoor: string | null,
                Severity: Major
                Found in app/javascript/react/components/Graph/graphConfig.ts - About 2 hrs to fix

                  Function getPlotOptions has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const getPlotOptions = (
                    fixedSessionTypeSelected: boolean,
                    streamId: number | null,
                    dispatch: any,
                    isIndoorParameterInUrl: boolean
                  Severity: Major
                  Found in app/javascript/react/components/Graph/graphConfig.ts - About 2 hrs to fix

                    File sessionsMap.js has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import * as FiltersUtils from "./filtersUtils";
                    import { clearMap } from "./clearMap";
                    import { applyTheme } from "./theme";
                    import { getParams } from "./params";
                    import sensors from "./sensors";
                    Severity: Minor
                    Found in app/javascript/javascript/sessionsMap.js - About 2 hrs to fix

                      Function getYAxisOptions has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const getYAxisOptions = (
                        thresholdsState: Thresholds,
                        isMobile: boolean = false
                      ): YAxisOptions => {
                        const min = Number(thresholdsState.min);
                      Severity: Major
                      Found in app/javascript/react/components/Graph/graphConfig.ts - About 2 hrs to fix

                        Function DesktopSensorFilter has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const DesktopSensorFilter = () => {
                          const [isBasicOpen, setIsBasicOpen] = useState(false);
                          const [moreOpen, setMoreOpen] = useState(false);
                          const { t } = useTranslation();
                          const { measurementType, sessionType, sensorName, setSensorParams } =
                        Severity: Major
                        Found in app/javascript/react/components/SessionFilters/SensorFilter.tsx - About 2 hrs to fix

                          Function extraReducers has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            extraReducers: (builder) => {
                              builder.addCase(fetchFixedStreamById.pending, (state) => {
                                state.status = StatusEnum.Pending;
                                state.error = null;
                                state.isLoading = true;
                          Severity: Major
                          Found in app/javascript/react/store/fixedStreamSlice.ts - About 2 hrs to fix

                            File CrowdMapMarkers.tsx has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { useMap } from "@vis.gl/react-google-maps";
                            import React, { useEffect, useMemo, useRef, useState } from "react";
                            import {
                              clearCrowdMap,
                              fetchCrowdMapData,
                            Severity: Minor
                            Found in app/javascript/react/components/Map/Markers/CrowdMapMarkers.tsx - About 2 hrs to fix

                              Function CrowdMapToggle has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const CrowdMapToggle = () => {
                                const {
                                  currentUserSettings,
                                  goToUserSettings,
                                  previousUserSettings,
                              Severity: Minor
                              Found in app/javascript/react/components/SessionFilters/CrowdmapToggle.tsx - 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 useHandleScrollEnd has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const useHandleScrollEnd = (
                                offset: number,
                                listSessions: SessionList[],
                                updateOffset: (offset: number) => void,
                                updateFetchedSessions: (count: number) => void,
                              Severity: Major
                              Found in app/javascript/react/utils/scrollEnd.ts - About 2 hrs to fix

                                Method call has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def call
                                    return Failure.new(form.errors) if form.invalid?
                                
                                    Success.new(
                                      sessions:
                                Severity: Major
                                Found in app/services/api/to_active_sessions_array.rb - About 2 hrs to fix

                                  Method call has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def call
                                      return Failure.new(form.errors) if form.invalid?
                                  
                                      Success.new(
                                        sessions:
                                  Severity: Major
                                  Found in app/services/api/to_dormant_sessions_array.rb - About 2 hrs to fix

                                    Function setupTimeRangeFilter has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const setupTimeRangeFilter = (
                                      onTimeRangeChanged,
                                      timeFrom,
                                      timeTo,
                                      onIsVisibleChange
                                    Severity: Major
                                    Found in app/javascript/javascript/filtersUtils.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language