HabitatMap/AirCasting

View on GitHub

Showing 667 of 667 total issues

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

      west === undefined ||
      east === undefined ||
      south === undefined ||
      north === undefined ||
      timeFrom === undefined ||
Severity: Major
Found in app/javascript/react/api/apiEndpoints.ts and 1 other location - About 2 hrs to fix
app/javascript/react/api/apiEndpoints.ts on lines 135..144

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

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

      west === undefined ||
      east === undefined ||
      south === undefined ||
      north === undefined ||
      timeFrom === undefined ||
Severity: Major
Found in app/javascript/react/api/apiEndpoints.ts and 1 other location - About 2 hrs to fix
app/javascript/react/api/apiEndpoints.ts on lines 71..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 77.

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

        if (session.sessions === 1) {
          const valueText = `${Math.round(session.value)} ${unitSymbol}`;
          icon = createMarkerIcon(color, valueText, false, false);
        } else {
          icon = createClusterIcon(color, false);
app/javascript/react/components/Map/Markers/TimelapseMarkers.tsx on lines 54..59

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

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

  const handleInputChange = (thresholdKey: keyof Thresholds, value: string) => {
    const trimmedValue = value.trim();
    if (trimmedValue === "") {
      setInputValue("");
      setErrorMessage(t("thresholdConfigurator.emptyInputMessage"));
Severity: Major
Found in app/javascript/react/utils/thresholdEventHandlers.ts - About 2 hrs to fix

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

    export interface MobileStreamState {
      data: MobileStream;
      minMeasurementValue: number | null;
      maxMeasurementValue: number | null;
      averageMeasurementValue: number | null;
    Severity: Major
    Found in app/javascript/react/store/mobileStreamSlice.ts and 1 other location - About 2 hrs to fix
    app/javascript/react/store/fixedStreamSlice.ts on lines 11..19

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

    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

                <SectionButton
                  title={t("map.legendTile")}
                  image={mapLegend}
                  alt={t("map.altlegendTile")}
                  onClick={() => goToUserSettings(UserSettings.MapLegendView)}
    Severity: Major
    Found in app/javascript/react/components/Map/Map.tsx and 1 other location - About 2 hrs to fix
    app/javascript/react/components/Map/Map.tsx on lines 788..795

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

    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 interface FixedStreamState {
      data: FixedStream;
      minMeasurementValue: number | null;
      maxMeasurementValue: number | null;
      averageMeasurementValue: number | null;
    Severity: Major
    Found in app/javascript/react/store/fixedStreamSlice.ts and 1 other location - About 2 hrs to fix
    app/javascript/react/store/mobileStreamSlice.ts on lines 10..18

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 76.

    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

                <SectionButton
                  title={t("map.listSessions")}
                  image={pinImage}
                  alt={t("map.altListSessions")}
                  onClick={() => goToUserSettings(UserSettings.SessionListView)}
    Severity: Major
    Found in app/javascript/react/components/Map/Map.tsx and 1 other location - About 2 hrs to fix
    app/javascript/react/components/Map/Map.tsx on lines 796..803

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

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

      private applyStyles() {
        if (!this.div) return;
    
        this.div.innerHTML = "";
    
    
    Severity: Major
    Found in app/javascript/react/components/Map/Markers/clusterOverlay.ts - About 2 hrs to fix

      Function setSensor has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const setSensor = (
        selectedParameter: ParameterType,
        sensors: Sensor[],
        sessionType: string
      ) => {
      Severity: Major
      Found in app/javascript/react/utils/setSensor.ts - About 2 hrs to fix

        Function handleMarkerClick has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const handleMarkerClick = (
            selectedStreamId: number | null,
            id: number | null
          ) => {
            if (currentUserSettings !== UserSettings.SessionListView) {
        Severity: Major
        Found in app/javascript/react/components/Map/Map.tsx - About 2 hrs to fix

          Function selectFixedStreamShortInfo has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            (fixedStreamData, lastDailyAverage): FixedStreamShortInfo => {
              const { value: lastMeasurementValue, date } = lastDailyAverage || {};
          
              const lastMeasurementDateLabel = moment(date).format("MMM D");
              const lastUpdate = moment
          Severity: Minor
          Found in app/javascript/react/store/fixedStreamSelectors.ts - About 2 hrs to fix

            Function MeasurementComponent has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const MeasurementComponent: React.FC = () => {
              const { t } = useTranslation();
            
              const extremes = useAppSelector(selectFixedExtremes);
              const thresholds = useAppSelector(selectThresholds);
            Severity: Minor
            Found in app/javascript/react/components/Graph/MeasurementComponent.tsx - About 2 hrs to fix

              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

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

                  class Mobile::AutocompleteController < ApplicationController
                    def tags
                      GoogleAnalyticsWorker::RegisterEvent.async_call(
                        'Autocomplete Mobile#tags'
                      )
                Severity: Major
                Found in app/controllers/api/mobile/autocomplete_controller.rb and 1 other location - About 1 hr to fix
                app/controllers/api/fixed/autocomplete_controller.rb on lines 2..23

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

                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

                        <S.Wrapper>
                          <S.ProfileName>{streamShortInfo.profile}</S.ProfileName>
                          <S.SensorName>{streamShortInfo.sensorName}</S.SensorName>
                        </S.Wrapper>
                app/javascript/react/components/Graph/TimeRage.tsx on lines 31..34
                app/javascript/react/components/Graph/TimeRage.tsx on lines 36..39

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

                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

                  class Fixed::AutocompleteController < ApplicationController
                    def tags
                      GoogleAnalyticsWorker::RegisterEvent.async_call('Autocomplete Fixed#tags')
                      q = params.to_unsafe_hash[:q].symbolize_keys
                
                
                Severity: Major
                Found in app/controllers/api/fixed/autocomplete_controller.rb and 1 other location - About 1 hr to fix
                app/controllers/api/mobile/autocomplete_controller.rb on lines 2..25

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

                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

                            <S.TimeContainer>
                              <S.Date>{minTime.date}</S.Date>
                              <S.Time>{minTime.time}</S.Time>
                            </S.TimeContainer>
                Severity: Major
                Found in app/javascript/react/components/Graph/TimeRage.tsx and 2 other locations - About 1 hr to fix
                app/javascript/react/components/Graph/TimeRage.tsx on lines 36..39
                app/javascript/react/components/Modals/SessionDetailsModal/SessionInfo/ModalMobileHeader.tsx on lines 70..73

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

                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

                            <S.TimeContainer>
                              <S.Date>{maxTime.date}</S.Date>
                              <S.Time>{maxTime.time}</S.Time>
                            </S.TimeContainer>
                Severity: Major
                Found in app/javascript/react/components/Graph/TimeRage.tsx and 2 other locations - About 1 hr to fix
                app/javascript/react/components/Graph/TimeRage.tsx on lines 31..34
                app/javascript/react/components/Modals/SessionDetailsModal/SessionInfo/ModalMobileHeader.tsx on lines 70..73

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

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

                    (selectedParameter: ParameterType, sensors: Sensor[]) => {
                      const sensorData = setSensor(selectedParameter, sensors, sessionType);
                      const commonParams = [
                        {
                          key: UrlParamsTypes.previousUserSettings,
                Severity: Minor
                Found in app/javascript/react/utils/mapParamsHandler.ts - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language