HabitatMap/AirCasting

View on GitHub

Showing 239 of 667 total issues

Function getRangeSelectorOptions has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

const getRangeSelectorOptions = (
  isMobile: boolean,
  fixedSessionTypeSelected: boolean,
  totalDuration: number,
  selectedRange: number,
Severity: Minor
Found in app/javascript/react/components/Graph/graphConfig.ts - About 3 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 Graph has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  ({ streamId, sessionType, isCalendarPage, rangeDisplayRef }) => {
    const graphRef = useRef<HTMLDivElement>(null);

    // Hooks
    const dispatch = useAppDispatch();
Severity: Minor
Found in app/javascript/react/components/Graph/Graph.tsx - About 3 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 infoWindow has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const infoWindow = () => {
  var InfoWindow = function () {
    this.popup = new google.maps.InfoWindow();
  };

Severity: Major
Found in app/javascript/javascript/infoWindow.js - About 3 hrs to fix

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

    require 'rails_helper'
    
    describe Api::Mobile::SessionsController do
      describe '#index' do
        it 'returns sessions json' do
    Severity: Minor
    Found in spec/controllers/api/mobile/sessions_controller_spec.rb - About 3 hrs to fix

      Function createClusterIcon has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const createClusterIcon = (
        color: string,
        shouldPulse: boolean
      ): google.maps.Icon => {
        const cacheKey = `${color}-cluster-${shouldPulse}`;
      Severity: Major
      Found in app/javascript/react/components/Map/Markers/createMarkerIcon.ts - About 3 hrs to fix

        Function handleMouseMove has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

          (
            thresholdKey: keyof Thresholds,
            startX: number,
            startValue: number,
            thresholdValues: Thresholds,
        Severity: Minor
        Found in app/javascript/react/utils/thresholdGestureHandlers.ts - About 3 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

        Method up has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

          def up
            Session.transaction do
              Session
                .all
                .select { |s| !s.timezone_offset }
        Severity: Minor
        Found in db/migrate/20120220090451_fix_missing_timezones.rb - About 3 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

        File MobileMarkers.tsx has 289 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        "use client";
        
        import { useMap } from "@vis.gl/react-google-maps";
        import { useCallback, useEffect, useRef, useState } from "react";
        import { useSelector } from "react-redux";
        Severity: Minor
        Found in app/javascript/react/components/Map/Markers/MobileMarkers.tsx - About 2 hrs to fix

          Function handleMouseMove has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            (moveEvent: globalThis.MouseEvent) => {
              // How much the thumb has moved horizontally since drag started.
              const displacement = moveEvent.clientX - startX;
          
              // Threshold new percentage, based on thumb value when dragging started,
          Severity: Major
          Found in app/javascript/react/utils/thresholdGestureHandlers.ts - About 2 hrs to fix

            Method change has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

              def change
                add_index :taggings, :tag_id unless index_exists? :taggings, :tag_id
                unless index_exists? :taggings, :taggable_id
                  add_index :taggings, :taggable_id
                end

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

                move: function () {
                  var parentOffset = { top: 0, left: 0 },
                    containerTop;
                  var parentRightEdge = $(window).width();
                  if (!this.parentEl.is("body")) {
            Severity: Major
            Found in app/javascript/jquery.ui.daterangepicker.js - About 2 hrs to fix

              Function updateMarkers has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const updateMarkers = useCallback(() => {
                  markerRefs.current.forEach((marker, streamId) => {
                    const session = sessions.find((s) => s.point.streamId === streamId);
                    if (!session) return;
              
              
              Severity: Major
              Found in app/javascript/react/components/Map/Markers/MobileMarkers.tsx - About 2 hrs to fix

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

                import { Link } from "react-router-dom";
                import Popup from "reactjs-popup";
                import styled from "styled-components";
                
                import {

                  Function exports has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function (api) {
                    var validEnv = ["development", "test", "production"];
                    var currentEnv = api.env();
                    var isDevelopmentEnv = api.env("development");
                    var isProductionEnv = api.env("production");
                  Severity: Major
                  Found in babel.config.js - About 2 hrs to fix

                    File session.rb has 282 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

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

                      Function ExportDataComponent has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const ExportDataComponent = ({
                        button,
                        fixedSessionTypeSelected,
                        sessionsIds,
                        onSubmit,
                      Severity: Minor
                      Found in app/javascript/react/components/Popups/ExportDataComponent.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 createArrows has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const createArrows = () => {
                          const chartWidth = chart.chartWidth;
                          const chartHeight = chart.chartHeight;
                      
                          // Remove existing arrows if any
                      Severity: Major
                      Found in app/javascript/react/components/Graph/chartEvents.ts - About 2 hrs to fix

                        Function DormantToggle has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const DormantToggle = () => {
                          const { t } = useTranslation();
                          const dispatch = useAppDispatch();
                          const { isActive, updateIsActive, updateTime } = useMapParams();
                        
                        
                        Severity: Major
                        Found in app/javascript/react/components/SessionFilters/DormantToggle.tsx - About 2 hrs to fix

                          File map.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import _ from "underscore";
                          import { buildCustomMarker } from "./customMarker";
                          import { MarkerClusterer, SuperClusterAlgorithm } from "@googlemaps/markerclusterer";
                          import { fixedClusterStyles, pulsingMarkerStyles } from "./theme";
                          import {
                          Severity: Minor
                          Found in app/javascript/javascript/map.js - About 2 hrs to fix

                            File buildGraphOptions.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import Highcharts from "highcharts";
                            
                            const buildChart = ({ renderTo }) => ({
                              renderTo,
                              height: 230,
                            Severity: Minor
                            Found in app/javascript/javascript/buildGraphOptions.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language