HabitatMap/AirCasting

View on GitHub

Showing 667 of 667 total issues

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

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

          setDefaultThresholdsValues: (
            state,
            { payload: { min, low, middle, high, max } }: PayloadAction<Thresholds>
          ) => {
            state.defaultValues = { min, low, middle, high, max };
      Severity: Major
      Found in app/javascript/react/store/thresholdSlice.ts and 1 other location - About 2 hrs to fix
      app/javascript/react/store/thresholdSlice.ts on lines 117..122

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

      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

          setUserThresholdValues: (
            state,
            { payload: { min, low, middle, high, max } }: PayloadAction<Thresholds>
          ) => {
            state.userValues = { min, low, middle, high, max };
      Severity: Major
      Found in app/javascript/react/store/thresholdSlice.ts and 1 other location - About 2 hrs to fix
      app/javascript/react/store/thresholdSlice.ts on lines 111..116

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

      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

        window.location.hash
          .slice(2)
          .split("&")
          .filter((x) => x.length !== 0)
          .map((x) => x.split("="))
      Severity: Major
      Found in app/javascript/javascript/params.js and 1 other location - About 2 hrs to fix
      app/javascript/javascript/params.js on lines 12..18

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

      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

        window.location.hash
          .slice(2)
          .split("&")
          .filter((x) => x.length !== 0)
          .map((x) => x.split("="))
      Severity: Major
      Found in app/javascript/javascript/params.js and 1 other location - About 2 hrs to fix
      app/javascript/javascript/params.js on lines 2..8

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

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

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

                    drawMarkerWithoutLabel: function ({
                      object,
                      content,
                      colorClass,
                      callback,
                Severity: Major
                Found in app/javascript/javascript/map.js and 1 other location - About 2 hrs to fix
                app/javascript/javascript/map.js on lines 233..245

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

                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

                    drawMarkerWithLabel: function ({ object, content, colorClass, callback }) {
                      const customMarker = buildCustomMarker({
                        object,
                        content,
                        colorClass,
                Severity: Major
                Found in app/javascript/javascript/map.js and 1 other location - About 2 hrs to fix
                app/javascript/javascript/map.js on lines 214..231

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

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

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

                          expected_response = {
                            stream: {
                              session_id: session.id,
                              active: session.is_active,
                              title: session.title,
                  Severity: Major
                  Found in spec/serializers/fixed_stream_serializer_spec.rb and 1 other location - About 2 hrs to fix
                  spec/serializers/fixed_stream_serializer_spec.rb on lines 18..49

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

                  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

                          expected_response = {
                            stream: {
                              session_id: session.id,
                              active: session.is_active,
                              title: session.title,
                  Severity: Major
                  Found in spec/serializers/fixed_stream_serializer_spec.rb and 1 other location - About 2 hrs to fix
                  spec/serializers/fixed_stream_serializer_spec.rb on lines 63..94

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

                  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 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
                      Severity
                      Category
                      Status
                      Source
                      Language