HabitatMap/AirCasting

View on GitHub

Showing 239 of 667 total issues

Function renderTimePicker has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    renderTimePicker: function (side) {
      // Don't bother updating the time picker if it's currently disabled
      // because an end date hasn't been clicked yet
      if (side == "right" && !this.endDate) return;

Severity: Major
Found in app/javascript/jquery.ui.daterangepicker.js - About 6 hrs to fix

    Function determineZoomLevel has 158 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const determineZoomLevel = (results: google.maps.GeocoderResult[]) => {
      const locationTypes = results[0].types;
      const primaryType = locationTypes[0];
    
      // Based on: https://developers.google.com/maps/documentation/places/web-service/supported_types
    Severity: Major
    Found in app/javascript/react/utils/determineZoomLevel.ts - About 6 hrs to fix

      File sessions_controller_spec.rb has 420 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'rails_helper'
      
      describe Api::Fixed::Active::SessionsController do
        describe '#index' do
          it 'returns active sessions json' do
      Severity: Minor
      Found in spec/controllers/api/fixed/active/sessions_controller_spec.rb - About 6 hrs to fix

        Function getRangeSelectorOptions has 137 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const getRangeSelectorOptions = (
          isMobile: boolean,
          fixedSessionTypeSelected: boolean,
          totalDuration: number,
          selectedRange: number,
        Severity: Major
        Found in app/javascript/react/components/Graph/graphConfig.ts - About 5 hrs to fix

          Function ProfileNamesInput has 135 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const ProfileNamesInput = () => {
            const [items, setItems] = useState<string[]>([""]);
            const [inputValue, setInputValue] = useState<string>("");
            const [selectedItem, setSelectedItem] = useState<string>("");
            const dispatch = useAppDispatch();
          Severity: Major
          Found in app/javascript/react/components/SessionFilters/ProfileNamesInput.tsx - About 5 hrs to fix

            Function TagsInput has 130 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const TagsInput = () => {
              const [items, setItems] = useState<string[]>([""]);
              const [inputValue, setInputValue] = useState<string>("");
              const [selectedItem, setSelectedItem] = useState<string>("");
              const dispatch = useAppDispatch();
            Severity: Major
            Found in app/javascript/react/components/SessionFilters/TagsInput.tsx - About 5 hrs to fix

              Function ControlPanel has 124 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ControlPanel: React.FC = () => {
                const { mapTypeId, searchParams } = useMapParams();
                const navigate = useNavigate();
                const isFirstRender = useRef(true);
                const { t } = useTranslation();
              Severity: Major
              Found in app/javascript/react/components/Map/ControlPanel/ControlPanel.tsx - About 4 hrs to fix

                Function addNavigationArrows has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const addNavigationArrows = (
                  chart: Highcharts.Chart,
                  isCalendarPage: boolean,
                  isMobile: boolean
                ) => {
                Severity: Major
                Found in app/javascript/react/components/Graph/chartEvents.ts - About 4 hrs to fix

                  Function ThresholdSlider has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const ThresholdSlider: React.FC<ThresholdSliderProps> = ({
                    isMobileOldStyle,
                    useColorBoxStyle,
                    setErrorMessage,
                  }) => {

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

                  export const createMarkerIcon = (
                    color: string,
                    value: string,
                    isSelected: boolean = false,
                    shouldPulse: boolean
                  Severity: Major
                  Found in app/javascript/react/components/Map/Markers/createMarkerIcon.ts - About 4 hrs to fix

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

                    import Popup from "reactjs-popup";
                    import styled from "styled-components";
                    
                    import {
                      acBlue,

                      Function addNavigationArrows has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const addNavigationArrows = (
                        chart: Highcharts.Chart,
                        isCalendarPage: boolean,
                        isMobile: boolean
                      ) => {
                      Severity: Minor
                      Found in app/javascript/react/components/Graph/chartEvents.ts - About 4 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 MobileSessionFilters has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const MobileSessionFilters = ({
                        onClose,
                        fetchableSessionsCount,
                      }: MobileSessionFiltersProps) => {
                        const indoorSessionsState = useAppSelector(selectIndoorSessionsState);

                      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

                      File Graph.tsx has 348 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      // Graph.tsx
                      
                      import HighchartsReact from "highcharts-react-official";
                      import Highcharts, { Chart } from "highcharts/highstock";
                      import NoDataToDisplay from "highcharts/modules/no-data-to-display";
                      Severity: Minor
                      Found in app/javascript/react/components/Graph/Graph.tsx - About 4 hrs to fix

                        Function handleSelectedStreamId has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            const handleSelectedStreamId = (streamId: number | null) => {
                              if (fixedStreamStatus === StatusEnum.Pending) return;
                              if (streamId) {
                                const { latitude, longitude } = fixedStreamData?.stream ?? {};
                        
                        
                        Severity: Major
                        Found in app/javascript/react/components/Map/Markers/FixedMarkers.tsx - About 4 hrs to fix

                          File ThresholdSlider.tsx has 346 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import _ from "lodash";
                          import React, {
                            useCallback,
                            useEffect,
                            useLayoutEffect,

                            File user_sessions_controller_spec.rb has 333 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require 'rails_helper'
                            
                            describe Api::UserSessionsController do
                              let(:user) { FactoryBot.create(:user) }
                            
                            
                            Severity: Minor
                            Found in spec/controllers/api/user_sessions_controller_spec.rb - About 4 hrs to fix

                              Function MapButtons has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const MapButtons: React.FC = () => {
                                const { goToUserSettings, currentUserSettings, sessionType, isIndoor } =
                                  useMapParams();
                                const [activeButtons, setActiveButtons] = useState<ButtonTypes[]>([]);
                                const [activeCopyLinkButton, setActiveCopyLinkButton] = useState(false);
                              Severity: Major
                              Found in app/javascript/react/components/MapButtons/MapButtons.tsx - About 3 hrs to fix

                                Function customMarkerClass has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const customMarkerClass = () => {
                                  let klass;
                                  let zIndex = 10000;
                                
                                  return (() => {
                                Severity: Major
                                Found in app/javascript/javascript/customMarker.js - About 3 hrs to fix

                                  Function CrowdMapToggle has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const CrowdMapToggle = () => {
                                    const {
                                      currentUserSettings,
                                      goToUserSettings,
                                      previousUserSettings,
                                  Severity: Major
                                  Found in app/javascript/react/components/SessionFilters/CrowdmapToggle.tsx - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language