HabitatMap/AirCasting

View on GitHub

Showing 667 of 667 total issues

File sessions_controller_spec.rb has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

describe Api::Fixed::Active::SessionsController do
  describe '#index' do
    it 'returns active sessions json' do
Severity: Minor
Found in spec/controllers/api/fixed/active/sessions_controller_spec.rb - About 6 hrs to fix

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

        memoizedSessions.forEach((session) => {
          let marker = markerRefs.current.get(session.point.streamId);
          if (!marker) {
            marker = createMarker(session);
            markerRefs.current.set(session.point.streamId, marker);
    Severity: Major
    Found in app/javascript/react/components/Map/Markers/FixedMarkers.tsx and 1 other location - About 5 hrs to fix
    app/javascript/react/components/Map/Markers/FixedMarkers.tsx on lines 669..680

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

    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

            memoizedSessions.forEach((session) => {
              let marker = markerRefs.current.get(session.point.streamId);
              if (!marker) {
                marker = createMarker(session);
                markerRefs.current.set(session.point.streamId, marker);
    Severity: Major
    Found in app/javascript/react/components/Map/Markers/FixedMarkers.tsx and 1 other location - About 5 hrs to fix
    app/javascript/react/components/Map/Markers/FixedMarkers.tsx on lines 388..399

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

    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

      async (sessionsData, { rejectWithValue }) => {
        try {
          const response: AxiosResponse<TimelapseData> = await apiClient.get(
            API_ENDPOINTS.fetchTimelapseData(sessionsData.filters)
          );
    Severity: Major
    Found in app/javascript/react/store/timelapseSlice.ts and 1 other location - About 5 hrs to fix
    app/javascript/react/store/mobileSessionsSlice.ts on lines 75..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 148.

    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

      async (sessionsData, { rejectWithValue }) => {
        try {
          const response: AxiosResponse<SessionsResponse> = await oldApiClient.get(
            API_ENDPOINTS.fetchMobileSessions(sessionsData.filters)
          );
    Severity: Major
    Found in app/javascript/react/store/mobileSessionsSlice.ts and 1 other location - About 5 hrs to fix
    app/javascript/react/store/timelapseSlice.ts on lines 39..60

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

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

    const getRangeSelectorOptions = (
      isMobile: boolean,
      fixedSessionTypeSelected: boolean,
      totalDuration: number,
      selectedRange: number,
    Severity: Major
    Found in app/javascript/react/components/Graph/graphConfig.ts - About 5 hrs to fix

      Function ProfileNamesInput has 135 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const ProfileNamesInput = () => {
        const [items, setItems] = useState<string[]>([""]);
        const [inputValue, setInputValue] = useState<string>("");
        const [selectedItem, setSelectedItem] = useState<string>("");
        const dispatch = useAppDispatch();
      Severity: Major
      Found in app/javascript/react/components/SessionFilters/ProfileNamesInput.tsx - About 5 hrs to fix

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

        const selectMobileExtremes = createSelector(
          [selectExtremesValues],
          (mobileStreamData) => {
            const {
              averageMeasurementValue,
        Severity: Major
        Found in app/javascript/react/store/mobileStreamSelectors.ts and 1 other location - About 5 hrs to fix
        app/javascript/react/store/fixedStreamSelectors.ts on lines 20..45

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

        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 selectFixedExtremes = createSelector(
          [selectFixedStream],
          (fixedStream) => {
            const {
              averageMeasurementValue,
        Severity: Major
        Found in app/javascript/react/store/fixedStreamSelectors.ts and 1 other location - About 5 hrs to fix
        app/javascript/react/store/mobileStreamSelectors.ts on lines 77..102

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

        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 fetchRectangleData = createAsyncThunk<
          RectangleData,
          string,
          { rejectValue: ApiError }
        >("rectangle/fetchRectangleData", async (params, { rejectWithValue }) => {
        Severity: Major
        Found in app/javascript/react/store/rectangleSlice.ts and 1 other location - About 5 hrs to fix
        app/javascript/react/store/clusterSlice.ts on lines 30..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 142.

        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 fetchClusterData = createAsyncThunk<
          ClusterData,
          string[],
          { rejectValue: ApiError }
        >("cluster/fetchClusterData", async (streamIds, { rejectWithValue }) => {
        Severity: Major
        Found in app/javascript/react/store/clusterSlice.ts and 1 other location - About 5 hrs to fix
        app/javascript/react/store/rectangleSlice.ts on lines 27..52

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

        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.MobileMenuContainer className="active-overlay">
                    <a
                      href={urls.aircasting}
                      aria-label={t("navbar.sections.aircastingPage")}
                    >
        Severity: Major
        Found in app/javascript/react/components/Navbar/MobileHeader.tsx and 1 other location - About 5 hrs to fix
        app/javascript/react/components/Navbar/DesktopHeader.tsx on lines 49..65

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 141.

        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.SmallDesktopMenuContainer>
                          <a
                            href={urls.aircasting}
                            aria-label={t("navbar.sections.aircastingPage")}
                          >
        Severity: Major
        Found in app/javascript/react/components/Navbar/DesktopHeader.tsx and 1 other location - About 5 hrs to fix
        app/javascript/react/components/Navbar/MobileHeader.tsx on lines 68..84

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

        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

          context 'calendar feature enabled, default thresholds not assigned' do
            it 'returns fixed stream data' do
              session = create_fixed_session!
              stream = create_stream!({ session: session })
              measurement_1 = create_measurement!({ stream: stream })
        Severity: Major
        Found in spec/requests/fixed_streams_spec.rb and 1 other location - About 5 hrs to fix
        spec/requests/fixed_streams_spec.rb on lines 121..175

        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

          context 'calendar feature enabled, default thresholds assigned' do
            it 'returns fixed stream data' do
              session = create_fixed_session!
              stream = create_stream!({ session: session })
              measurement_1 = create_measurement!({ stream: stream })
        Severity: Major
        Found in spec/requests/fixed_streams_spec.rb and 1 other location - About 5 hrs to fix
        spec/requests/fixed_streams_spec.rb on lines 4..58

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

        const TagsInput = () => {
          const [items, setItems] = useState<string[]>([""]);
          const [inputValue, setInputValue] = useState<string>("");
          const [selectedItem, setSelectedItem] = useState<string>("");
          const dispatch = useAppDispatch();
        Severity: Major
        Found in app/javascript/react/components/SessionFilters/TagsInput.tsx - About 5 hrs to fix

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

                      <S.MinMaxValueContainer $isMobile={false}>
                        <div>
                          <S.SmallDot
                            $color={getColorForValue(thresholds, minMeasurementValue)}
                          />
          app/javascript/react/components/Modals/SessionDetailsModal/SessionInfo/ModalMobileHeader.tsx on lines 79..94

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

          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.MinMaxValueContainer $isMobile={isMobile}>
                          <div>
                            <S.SmallDot
                              $color={getColorForValue(thresholds, minMeasurementValue)}
                            />
          app/javascript/react/components/Modals/SessionDetailsModal/SessionInfo/ModalDesktopHeader.tsx on lines 81..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 138.

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

          const ControlPanel: React.FC = () => {
            const { mapTypeId, searchParams } = useMapParams();
            const navigate = useNavigate();
            const isFirstRender = useRef(true);
            const { t } = useTranslation();
          Severity: Major
          Found in app/javascript/react/components/Map/ControlPanel/ControlPanel.tsx - About 4 hrs to fix

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

                if (hasMoreSessions) {
                  const newOffset = offset + listSessions.length;
                  updateOffset(newOffset);
            
                  const updatedFilters = {
            Severity: Major
            Found in app/javascript/react/utils/scrollEnd.ts and 1 other location - About 4 hrs to fix
            app/javascript/react/utils/scrollEnd.ts on lines 47..68

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

            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

            Severity
            Category
            Status
            Source
            Language