HabitatMap/AirCasting

View on GitHub

Showing 667 of 667 total issues

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

  draw() {
    if (!this.div) return;
    const overlayProjection = this.getProjection();
    const pos = overlayProjection.fromLatLngToDivPixel(this.position);
    if (pos) {
app/javascript/react/components/Map/Markers/clusterOverlay.ts on lines 62..70
app/javascript/react/components/Map/Markers/customMarkerLabel.ts on lines 47..55

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

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 3 locations. Consider refactoring.
Open

      case "low":
        if (
          currentValue >= thresholdValues.middle &&
          thresholdValues.middle !== thresholdValues.max
        ) {
Severity: Major
Found in app/javascript/react/utils/thresholdGestureHandlers.ts and 2 other locations - About 4 hrs to fix
app/javascript/react/utils/thresholdGestureHandlers.ts on lines 65..78
app/javascript/react/utils/thresholdGestureHandlers.ts on lines 79..95

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

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 3 locations. Consider refactoring.
Open

      case "middle":
        if (
          currentValue <= thresholdValues.low &&
          thresholdValues.low !== thresholdValues.min
        ) {
Severity: Major
Found in app/javascript/react/utils/thresholdGestureHandlers.ts and 2 other locations - About 4 hrs to fix
app/javascript/react/utils/thresholdGestureHandlers.ts on lines 48..64
app/javascript/react/utils/thresholdGestureHandlers.ts on lines 79..95

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

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 3 locations. Consider refactoring.
Open

  draw() {
    if (!this.div) return;
    const overlayProjection = this.getProjection();
    const pos = overlayProjection.fromLatLngToDivPixel(this.position);
    if (pos) {
app/javascript/react/components/Map/Markers/customMarkerLabel.ts on lines 47..55
app/javascript/react/components/Map/Markers/customMarkerOverlay.ts on lines 67..75

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

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 3 locations. Consider refactoring.
Open

  draw() {
    if (!this.div) return;
    const overlayProjection = this.getProjection();
    const pos = overlayProjection.fromLatLngToDivPixel(this.position);
    if (pos) {
app/javascript/react/components/Map/Markers/clusterOverlay.ts on lines 62..70
app/javascript/react/components/Map/Markers/customMarkerOverlay.ts on lines 67..75

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

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 Graph.tsx has 348 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Graph.tsx

import HighchartsReact from "highcharts-react-official";
import Highcharts, { Chart } from "highcharts/highstock";
import NoDataToDisplay from "highcharts/modules/no-data-to-display";
Severity: Minor
Found in app/javascript/react/components/Graph/Graph.tsx - About 4 hrs to fix

    Function handleSelectedStreamId has 108 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const handleSelectedStreamId = (streamId: number | null) => {
          if (fixedStreamStatus === StatusEnum.Pending) return;
          if (streamId) {
            const { latitude, longitude } = fixedStreamData?.stream ?? {};
    
    
    Severity: Major
    Found in app/javascript/react/components/Map/Markers/FixedMarkers.tsx - About 4 hrs to fix

      File ThresholdSlider.tsx has 346 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import _ from "lodash";
      import React, {
        useCallback,
        useEffect,
        useLayoutEffect,

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

              if (this.maxDate && this.startDate.isAfter(this.maxDate)) {
                this.startDate = this.maxDate.clone();
                if (this.timePicker && this.timePickerIncrement)
                  this.startDate.minute(
                    Math.floor(this.startDate.minute() / this.timePickerIncrement) *
        Severity: Major
        Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 4 hrs to fix
        app/javascript/jquery.ui.daterangepicker.js on lines 523..530

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

        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.minDate && this.startDate.isBefore(this.minDate)) {
                this.startDate = this.minDate.clone();
                if (this.timePicker && this.timePickerIncrement)
                  this.startDate.minute(
                    Math.round(this.startDate.minute() / this.timePickerIncrement) *
        Severity: Major
        Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 4 hrs to fix
        app/javascript/jquery.ui.daterangepicker.js on lines 532..539

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

        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.ColorBoxNumberInput
                inputMode="numeric"
                type="number"
                step={1}
                value={activeInput === "min" ? inputValue : min.toString()}
        app/javascript/react/components/ThresholdConfigurator/ThresholdSlider.tsx on lines 347..356

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

        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 selectFixedSessionsPoints = createSelector(
          [selectTransformedSessionsByType],
          (transformedSessions): Session[] => {
            return transformedSessions.map(
              ({
        Severity: Major
        Found in app/javascript/react/store/fixedSessionsSelectors.ts and 1 other location - About 4 hrs to fix
        app/javascript/react/store/fixedSessionsSelectors.ts on lines 103..126

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

        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 selectFixedSessionsList = createSelector(
          [selectTransformedSessionsByType],
          (transformedSessions): SessionList[] => {
            return transformedSessions.map(
              ({
        Severity: Major
        Found in app/javascript/react/store/fixedSessionsSelectors.ts and 1 other location - About 4 hrs to fix
        app/javascript/react/store/fixedSessionsSelectors.ts on lines 78..101

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

        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

                    {customParameters.length > 0 && (
                      <S.SeeMoreButton onClick={() => setMoreOpen(!moreOpen)}>
                        <S.SeeMoreSpan>
                          {t(`filters.${moreOpen ? "seeLess" : "seeMore"}`)}
                        </S.SeeMoreSpan>
        app/javascript/react/components/SessionFilters/SensorFilter.tsx on lines 156..163

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

        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.ColorBoxNumberInput
                inputMode="numeric"
                type="number"
                step={5}
                value={activeInput === "max" ? inputValue : max.toString()}
        app/javascript/react/components/ThresholdConfigurator/ThresholdSlider.tsx on lines 319..328

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

        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

                    {customSensors.length > 0 && (
                      <S.SeeMoreButton onClick={() => setMoreOpen(!moreOpen)}>
                        <S.SeeMoreSpan>
                          {t(`filters.${moreOpen ? "seeLess" : "seeMore"}`)}
                        </S.SeeMoreSpan>
        app/javascript/react/components/SessionFilters/ParameterFilter.tsx on lines 135..142

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

        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 user_sessions_controller_spec.rb has 333 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'rails_helper'
        
        describe Api::UserSessionsController do
          let(:user) { FactoryBot.create(:user) }
        
        
        Severity: Minor
        Found in spec/controllers/api/user_sessions_controller_spec.rb - About 4 hrs to fix

          Function MapButtons has 99 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const MapButtons: React.FC = () => {
            const { goToUserSettings, currentUserSettings, sessionType, isIndoor } =
              useMapParams();
            const [activeButtons, setActiveButtons] = useState<ButtonTypes[]>([]);
            const [activeCopyLinkButton, setActiveCopyLinkButton] = useState(false);
          Severity: Major
          Found in app/javascript/react/components/MapButtons/MapButtons.tsx - About 3 hrs to fix

            Function customMarkerClass has 95 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const customMarkerClass = () => {
              let klass;
              let zIndex = 10000;
            
              return (() => {
            Severity: Major
            Found in app/javascript/javascript/customMarker.js - About 3 hrs to fix

              Function CrowdMapToggle has 95 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const CrowdMapToggle = () => {
                const {
                  currentUserSettings,
                  goToUserSettings,
                  previousUserSettings,
              Severity: Major
              Found in app/javascript/react/components/SessionFilters/CrowdmapToggle.tsx - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language