HabitatMap/AirCasting

View on GitHub

Showing 667 of 667 total issues

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

        if (
          this.leftCalendar.month.format("YYYY-MM") !=
            this.startDate.format("YYYY-MM") &&
          this.rightCalendar.month.format("YYYY-MM") !=
            this.startDate.format("YYYY-MM")
Severity: Major
Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 2 hrs to fix
app/javascript/jquery.ui.daterangepicker.js on lines 674..685

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

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

test("when returns a username", (t) => {
  const username = "user1234";
  const session = {
    username,
    stream: {},
Severity: Major
Found in app/javascript/javascript/tests/session.test.js and 1 other location - About 2 hrs to fix
app/javascript/javascript/tests/session.test.js on lines 14..26

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

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

      if (
        this.maxDate &&
        this.linkedCalendars &&
        !this.singleDatePicker &&
        this.rightCalendar.month > this.maxDate
Severity: Major
Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 2 hrs to fix
app/javascript/jquery.ui.daterangepicker.js on lines 661..672

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

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

test("when title is present it uses it", (t) => {
  const title = "walk to the park";
  const session = {
    title,
    stream: {},
Severity: Major
Found in app/javascript/javascript/tests/session.test.js and 1 other location - About 2 hrs to fix
app/javascript/javascript/tests/session.test.js on lines 28..40

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

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 {
    boundWest,
    boundEast,
    boundNorth,
    boundSouth,
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 25..40

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

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 ShadowCircle = styled.div<MarkerShadowProps>`
  height: 4rem;
  width: 4rem;
  border-radius: 50%;
  background: radial-gradient(
app/javascript/react/components/Map/Markers/SessionDotMarker/SessionDotMarker.style.tsx on lines 54..67

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

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 MarkerCircle = styled.div<MarkerProps>`
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background-color: ${(props) => props.color};
app/javascript/react/components/Map/Markers/SessionFullMarker/SessionFullMarker.style.tsx on lines 45..63

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

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 {
    boundWest,
    boundEast,
    boundNorth,
    boundSouth,
app/javascript/react/components/SessionFilters/TagsInput.tsx on lines 25..40

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

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

const getYAxisOptions = (
  thresholdsState: Thresholds,
  isMobile: boolean = false
): YAxisOptions => {
  const min = Number(thresholdsState.min);
Severity: Major
Found in app/javascript/react/components/Graph/graphConfig.ts - About 2 hrs to fix

    Function DesktopSensorFilter has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const DesktopSensorFilter = () => {
      const [isBasicOpen, setIsBasicOpen] = useState(false);
      const [moreOpen, setMoreOpen] = useState(false);
      const { t } = useTranslation();
      const { measurementType, sessionType, sensorName, setSensorParams } =
    Severity: Major
    Found in app/javascript/react/components/SessionFilters/SensorFilter.tsx - About 2 hrs to fix

      Function extraReducers has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        extraReducers: (builder) => {
          builder.addCase(fetchFixedStreamById.pending, (state) => {
            state.status = StatusEnum.Pending;
            state.error = null;
            state.isLoading = true;
      Severity: Major
      Found in app/javascript/react/store/fixedStreamSlice.ts - About 2 hrs to fix

        File CrowdMapMarkers.tsx has 261 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { useMap } from "@vis.gl/react-google-maps";
        import React, { useEffect, useMemo, useRef, useState } from "react";
        import {
          clearCrowdMap,
          fetchCrowdMapData,
        Severity: Minor
        Found in app/javascript/react/components/Map/Markers/CrowdMapMarkers.tsx - About 2 hrs to fix

          Function CrowdMapToggle has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          const CrowdMapToggle = () => {
            const {
              currentUserSettings,
              goToUserSettings,
              previousUserSettings,
          Severity: Minor
          Found in app/javascript/react/components/SessionFilters/CrowdmapToggle.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

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

            const handleInputChange = (
              event: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>
            ): void => {
              const { name, value } = event.target;
              setFormState((prevFormData) => ({
          Severity: Major
          Found in app/javascript/react/components/Modals/CopyLinkModal.tsx and 1 other location - About 2 hrs to fix
          app/javascript/react/components/Popups/ExportDataComponent.tsx on lines 72..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 80.

          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

              builder.addCase(
                fetchTimelapseData.rejected,
                (state, action: PayloadAction<ApiError | undefined>) => {
                  state.status = StatusEnum.Rejected;
                  state.error = action.payload || {
          Severity: Major
          Found in app/javascript/react/store/timelapseSlice.ts and 1 other location - About 2 hrs to fix
          app/javascript/react/store/crowdMapSlice.ts on lines 71..92

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

          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 handleInputChange = (
              event: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>
            ): void => {
              const { name, value } = event.target;
              setFormState((prevFormData) => ({
          app/javascript/react/components/Modals/CopyLinkModal.tsx on lines 46..54

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

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

          export const useHandleScrollEnd = (
            offset: number,
            listSessions: SessionList[],
            updateOffset: (offset: number) => void,
            updateFetchedSessions: (count: number) => void,
          Severity: Major
          Found in app/javascript/react/utils/scrollEnd.ts - About 2 hrs to fix

            Method call has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def call
                return Failure.new(form.errors) if form.invalid?
            
                Success.new(
                  sessions:
            Severity: Major
            Found in app/services/api/to_active_sessions_array.rb - About 2 hrs to fix

              Method call has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def call
                  return Failure.new(form.errors) if form.invalid?
              
                  Success.new(
                    sessions:
              Severity: Major
              Found in app/services/api/to_dormant_sessions_array.rb - About 2 hrs to fix

                Function setupTimeRangeFilter has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const setupTimeRangeFilter = (
                  onTimeRangeChanged,
                  timeFrom,
                  timeTo,
                  onIsVisibleChange
                Severity: Major
                Found in app/javascript/javascript/filtersUtils.js - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language