HabitatMap/AirCasting

View on GitHub

Showing 667 of 667 total issues

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

    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

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

        useEffect(() => {
          if (hoverStreamId) {
            const hoveredSession = memoizedSessions.find(
              (session) => Number(session.point.streamId) === hoverStreamId
            );
      app/javascript/react/components/Map/Markers/FixedMarkers.tsx on lines 505..516

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

      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

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

        useEffect(() => {
          if (hoverStreamId) {
            const hoveredSession = memoizedSessions.find(
              (session) => Number(session.point.streamId) === hoverStreamId
            );
      Severity: Major
      Found in app/javascript/react/components/Map/Markers/FixedMarkers.tsx and 1 other location - About 2 hrs to fix
      app/javascript/react/components/Map/Markers/DormantMarkers.tsx on lines 167..178

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

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

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

                  $(".js--time-range-button").on(
                    "apply.daterangepicker",
                    (_, mobilePicker) => {
                      const newStartDate = mobilePicker.startDate;
                      const newEndDate = mobilePicker.endDate;
              Severity: Major
              Found in app/javascript/javascript/filtersUtils.js and 1 other location - About 2 hrs to fix
              app/javascript/javascript/filtersUtils.js on lines 79..86

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

              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

                  $(".js--time-range").on("apply.daterangepicker", (_, desktopPicker) => {
                    const newStartDate = desktopPicker.startDate;
                    const newEndDate = desktopPicker.endDate;
              
                    const mobilePicker = $(".js--time-range-button").data("daterangepicker");
              Severity: Major
              Found in app/javascript/javascript/filtersUtils.js and 1 other location - About 2 hrs to fix
              app/javascript/javascript/filtersUtils.js on lines 67..77

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

              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

                const handleOnClose = (itemToRemove: string) => {
                  const usernamesUpdated =
                    decodedUsernamesArray &&
                    decodedUsernamesArray.filter((el) => el !== itemToRemove);
                  const decodedUsernamesString = usernamesUpdated
              app/javascript/react/components/SessionFilters/TagsInput.tsx on lines 110..115

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

              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

                const handleOnClose = (itemToRemove: string) => {
                  const tagsUpdated =
                    decodedTagsArray && decodedTagsArray.filter((el) => el !== itemToRemove);
                  const decodedTagsString = tagsUpdated ? tagsUpdated.join(", ") : "";
                  setFilter(UrlParamsTypes.tags, decodedTagsString.toString());
              Severity: Major
              Found in app/javascript/react/components/SessionFilters/TagsInput.tsx and 1 other location - About 2 hrs to fix
              app/javascript/react/components/SessionFilters/ProfileNamesInput.tsx on lines 108..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 84.

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

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

                            <S.AverageValueContainer>
                              <S.AverageDot
                                $color={getColorForValue(thresholds, averageValue)}
                              />
                              {t("sessionDetailsModal.averageValue")}
                app/javascript/react/components/Modals/SessionDetailsModal/SessionInfo/ModalMobileHeader.tsx on lines 58..65

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

                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

                            <S.AverageValueContainer>
                              <S.AverageDot
                                $color={getColorForValue(thresholds, averageValue)}
                              />
                              {t("sessionDetailsModal.averageValue")}
                app/javascript/react/components/Modals/SessionDetailsModal/SessionInfo/ModalDesktopHeader.tsx on lines 73..80

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

                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

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