HabitatMap/AirCasting

View on GitHub

Showing 667 of 667 total issues

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

        if (this.timePicker) {
          var hour = parseInt(
            this.container.find(".left .hourselect").val(),
            10
          );
Severity: Major
Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 1 day to fix
app/javascript/jquery.ui.daterangepicker.js on lines 1568..1586

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

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

File append_measurements_content_spec.rb has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

describe Csv::AppendMeasurementsContent do
  before(:each) { @subject = Csv::AppendMeasurementsContent.new }

Severity: Major
Found in spec/services/csv/append_measurements_content_spec.rb - About 1 day to fix

    Function renderCalendar has 224 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        renderCalendar: function (side) {
          //
          // Build the matrix of dates that will populate the calendar
          //
    
    
    Severity: Major
    Found in app/javascript/jquery.ui.daterangepicker.js - About 1 day to fix

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

        const { isOpen, getMenuProps, getInputProps, getItemProps, reset } =
          useCombobox({
            items: profileNames,
            inputValue,
            selectedItem,
      app/javascript/react/components/SessionFilters/TagsInput.tsx on lines 68..93

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

      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 { isOpen, getMenuProps, getInputProps, getItemProps, reset } =
          useCombobox({
            items: tagsToSelect,
            inputValue,
            selectedItem,
      Severity: Major
      Found in app/javascript/react/components/SessionFilters/TagsInput.tsx and 1 other location - About 1 day to fix
      app/javascript/react/components/SessionFilters/ProfileNamesInput.tsx on lines 69..93

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

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

      export const mapSettings = () => {
        return [
          {
            featureType: "administrative",
            elementType: "labels.text.fill",
      Severity: Major
      Found in app/javascript/javascript/mapSettings.js - About 1 day to fix

        Function useThresholdHandlers has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useThresholdHandlers = (
          setThresholdValues: React.Dispatch<React.SetStateAction<Thresholds>>,
          setInputValue: React.Dispatch<React.SetStateAction<string>>,
          setActiveInput: React.Dispatch<React.SetStateAction<keyof Thresholds | null>>,
          setErrorMessage: React.Dispatch<React.SetStateAction<string>>,
        Severity: Minor
        Found in app/javascript/react/utils/thresholdEventHandlers.ts - About 1 day 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 save has 213 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def save(streams)
            persisted_streams =
              Stream
                .select(:id, :min_latitude, :min_longitude, :sensor_name, :session_id)
                .joins(:session)
        Severity: Major
        Found in app/services/save_measurements.rb - About 1 day to fix

          Function useMapParams has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
          Open

          export const useMapParams = () => {
            const defaultThresholds = useAppSelector(selectDefaultThresholds);
            const thresholdValues = useAppSelector(selectThresholds);
            const isMobile: boolean = useMobileDetection();
            const [searchParams, setSearchParams] = useSearchParams();
          Severity: Minor
          Found in app/javascript/react/utils/mapParamsHandler.ts - About 1 day 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 ThresholdConfigurator.style.tsx has 493 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import styled from "styled-components";
          
          import * as colors from "../../assets/styles/colors";
          import { media } from "../../utils/media";
          import { Button } from "../Button/Button.style";

            File graphConfig.ts has 492 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {
              AlignValue,
              ChartOptions,
              ChartZoomingOptions,
              PlotOptions,
            Severity: Minor
            Found in app/javascript/react/components/Graph/graphConfig.ts - About 7 hrs to fix

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

                      if (this.endDate) {
                        hour = parseInt(this.container.find(".left .hourselect").val(), 10);
                        minute = parseInt(
                          this.container.find(".left .minuteselect").val(),
                          10
              Severity: Major
              Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 7 hrs to fix
              app/javascript/jquery.ui.daterangepicker.js on lines 705..719

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

              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

                      } else {
                        hour = parseInt(this.container.find(".right .hourselect").val(), 10);
                        minute = parseInt(
                          this.container.find(".right .minuteselect").val(),
                          10
              Severity: Major
              Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 7 hrs to fix
              app/javascript/jquery.ui.daterangepicker.js on lines 691..705

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

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

              export const useThresholdHandlers = (
                setThresholdValues: React.Dispatch<React.SetStateAction<Thresholds>>,
                setInputValue: React.Dispatch<React.SetStateAction<string>>,
                setActiveInput: React.Dispatch<React.SetStateAction<keyof Thresholds | null>>,
                setErrorMessage: React.Dispatch<React.SetStateAction<string>>,
              Severity: Major
              Found in app/javascript/react/utils/thresholdEventHandlers.ts - About 7 hrs to fix

                Function MobileMarkers has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                Open

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

                export function FixedMarkers({
                  sessions,
                  onMarkerClick,
                  selectedStreamId,
                  pulsatingSessionId,
                Severity: Minor
                Found in app/javascript/react/components/Map/Markers/FixedMarkers.tsx - About 7 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

                export const fetchUsernames = createAsyncThunk<
                  string[],
                  ParamsType,
                  { rejectValue: ApiError }
                >("autocomplete/usernames", async (params, { rejectWithValue }) => {
                Severity: Major
                Found in app/javascript/react/store/sessionFiltersSlice.ts and 1 other location - About 6 hrs to fix
                app/javascript/react/store/sessionFiltersSlice.ts on lines 71..96

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

                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

                export const fetchTags = createAsyncThunk<
                  string[],
                  ParamsType,
                  { rejectValue: ApiError }
                >("autocomplete/tags", async (params, { rejectWithValue }) => {
                Severity: Major
                Found in app/javascript/react/store/sessionFiltersSlice.ts and 1 other location - About 6 hrs to fix
                app/javascript/react/store/sessionFiltersSlice.ts on lines 44..69

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

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