HabitatMap/AirCasting

View on GitHub

Showing 239 of 667 total issues

Avoid deeply nested control flow statements.
Open

            if (isActive) {
              dispatch(
                fetchActiveIndoorSessions({ filters: indoorSessionsFilters })
              ).unwrap();
            } else {
Severity: Major
Found in app/javascript/react/components/Map/Map.tsx - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if (isActive) {
                  dispatch(fetchActiveFixedSessions({ filters })).unwrap();
                } else {
                  dispatch(fetchDormantFixedSessions({ filters })).unwrap();
                }
    Severity: Major
    Found in app/javascript/react/components/Map/Map.tsx - About 45 mins to fix

      Function TimelapseComponent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      > = React.memo(({ onClose }) => {
        const [showReadOnlyPopup, setShowReadOnlyPopup] = useState(false);
        const [currentStep, setCurrentStep] = useState(0);
      
        const isLoading = useAppSelector(selectTimelapseIsLoading);

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

      const getMonthWeeksOfDailyAveragesFor = (
        month: Moment,
        streamDailyAverages: StreamDailyAverage[]
      ): CalendarMonthlyData => {
        if (!month || !month.isValid() || !streamDailyAverages) {
      Severity: Minor
      Found in app/javascript/react/store/movingStreamSelectors.ts - About 45 mins 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 CrowdMapMarkers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const CrowdMapMarkers = ({ pulsatingSessionId, sessions }: Props) => {
        const dispatch = useAppDispatch();
      
        const crowdMapRectangles = useAppSelector(selectCrowdMapRectangles);
        const fetchingCrowdMapData = useAppSelector(selectFetchingCrowdMapData);
      Severity: Minor
      Found in app/javascript/react/components/Map/Markers/CrowdMapMarkers.tsx - About 45 mins 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

      Method build_measurements_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          amount_of_streams,
          measurements,
          sensor_package_name,
          session_id,
          stream_parameters
      Severity: Minor
      Found in app/services/csv/create_files.rb - About 35 mins to fix

        Method build_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            amount_of_streams,
            measurements,
            sensor_package_name,
            session_id,
            stream_parameters
        Severity: Minor
        Found in spec/services/csv/append_measurements_content_spec.rb - About 35 mins to fix

          Function updatePane has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            private updatePane() {
              if (!this.div) return;
              const panes = this.getPanes();
              if (panes) {
                if (this.div.parentElement) {
          Severity: Minor
          Found in app/javascript/react/components/Map/Markers/clusterOverlay.ts - About 35 mins 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

          Method show has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def show
                GoogleAnalyticsWorker::RegisterEvent.async_call('Mobile regions#show')
                data = params.to_unsafe_hash
                data[:stream_ids] ||= []
          
          
          Severity: Minor
          Found in app/controllers/api/mobile_regions_controller.rb - About 35 mins 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 createMobileSeriesData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          export const createMobileSeriesData = (
            data: Session[] | Measurement[],
            isGraphData: boolean
          ) =>
            data
          Severity: Minor
          Found in app/javascript/react/utils/createGraphData.ts - About 35 mins 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 getChartOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const getChartOptions = (
            isCalendarPage: boolean,
            isMobile: boolean
          ): ChartOptions => {
            const zoomingConfig: ChartZoomingOptions = {
          Severity: Minor
          Found in app/javascript/react/components/Graph/graphConfig.ts - About 35 mins 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

          Method prepare_range has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def prepare_range(name, field)
                  scope name,
                        lambda { |low, high|
                          if low && high
                            if low <= high
          Severity: Minor
          Found in lib/aircasting/filter_range.rb - About 35 mins 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 getClusterPixelPosition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const getClusterPixelPosition = (
            map: google.maps.Map,
            latLng: google.maps.LatLng
          ) => {
            const zoom = map.getZoom();
          Severity: Minor
          Found in app/javascript/react/utils/getClusterPixelPosition.ts - About 35 mins 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

          Method build! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def build!
              data = @session_data.clone
              session = nil
              jobs = []
          
          
          Severity: Minor
          Found in lib/session_builder.rb - About 35 mins 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 MobileHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          export const MobileHeader = ({
            isTimelapseView,
            toggleMenuVisibility,
            navMenuVisible,
            t,
          Severity: Minor
          Found in app/javascript/react/components/Navbar/MobileHeader.tsx - About 35 mins 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 DormantMarkers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const DormantMarkers: React.FC<DormantMarkersProps> = ({
            sessions,
            onMarkerClick,
            selectedStreamId,
            pulsatingSessionId,
          Severity: Minor
          Found in app/javascript/react/components/Map/Markers/DormantMarkers.tsx - About 35 mins 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 ThresholdButton has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const ThresholdButton: React.FC<ThresholdButtonProps> = ({
            variant = ThresholdButtonVariant.IconOnly,
            buttonText,
            swapIconTextPosition = false,
            useDarkBlueIcon = false,

          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

          Avoid too many return statements within this function.
          Open

                  return 5;
          Severity: Major
          Found in app/javascript/javascript/heat.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return "highest";
            Severity: Major
            Found in app/javascript/javascript/heat.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return 4;
              Severity: Major
              Found in app/javascript/javascript/heat.js - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language