HabitatMap/AirCasting

View on GitHub

Showing 667 of 667 total issues

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

  if (
    mobileStream.status === StatusEnum.Fulfilled &&
    mobileStream.data.id === sessionId
  ) {
    const min = Math.floor(mobileStream.minMeasurementValue!);
app/javascript/react/utils/uniformDistributionThresholdCalc.ts on lines 39..49

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  } else if (
    fixedStream.status === StatusEnum.Fulfilled &&
    fixedStream.data.stream.sessionId === sessionId
  ) {
    const min = Math.floor(fixedStream.minMeasurementValue!);
app/javascript/react/utils/uniformDistributionThresholdCalc.ts on lines 32..49

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

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

Method fixed_active_government_sessions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def fixed_active_government_sessions(sensor_name:, west:, east:, north:, south:)
    sensor_name = ActiveRecord::Base.connection.quote(sensor_name)

    sql = <<-SQL
      WITH recent_sessions AS (
Severity: Minor
Found in app/repositories/sessions_repository.rb - About 1 hr to fix

    Function RealtimeMapUpdatesButton has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const RealtimeMapUpdatesButton = () => {
      const { t } = useTranslation();
      const isMobile = useScreenSizeDetection(screenSizes.mobile);
    
      const dispatch = useAppDispatch();

      Function selectMobileStreamShortInfo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        (mobileStreamData, mobileSessionState): MobileStreamShortInfo => {
          const maxMeasurementValue = Math.max(
            ...mobileStreamData.measurements.map((m) => m.value)
          );
          const minMeasurementValue = Math.min(
      Severity: Minor
      Found in app/javascript/react/store/mobileStreamSelectors.ts - About 1 hr to fix

        Method build! has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def build!
            data = @session_data.clone
            session = nil
            jobs = []
        
        
        Severity: Minor
        Found in lib/session_builder.rb - About 1 hr to fix

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

            def call(sessions)
              sessions_array = []
          
              sessions.map do |session|
                sessions_array <<
          Severity: Minor
          Found in app/serializers/fixed_sessions_serializer.rb - About 1 hr to fix

            Function updateTime has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                (selectedYear: number) => {
                  setUrlParams([
                    {
                      key: UrlParamsTypes.previousUserSettings,
                      value: isMobile ? previousUserSettings : currentUserSettings,
            Severity: Minor
            Found in app/javascript/react/utils/mapParamsHandler.ts - About 1 hr to fix

              Function updateThumbPositionsHandler has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const updateThumbPositionsHandler = useCallback(() => {
                  if (sliderRef.current) {
                    const { min, low, middle, high, max } = thresholdValues;
                    const lowThumb = calculateThumbPosition(
                      low,

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

                    this.container
                      .find(".drp-buttons")
                      .on(
                        "click.daterangepicker",
                        "button.applyBtn",
                Severity: Major
                Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 1 hr to fix
                app/javascript/jquery.ui.daterangepicker.js on lines 440..443

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

                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

                    this.container
                      .find(".drp-calendar")
                      .on("click.daterangepicker", ".prev", $.proxy(this.clickPrev, this))
                      .on("click.daterangepicker", ".next", $.proxy(this.clickNext, this))
                Severity: Major
                Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 1 hr to fix
                app/javascript/jquery.ui.daterangepicker.js on lines 474..485

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

                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 (
                            this.startDate.format(format) ==
                              this.ranges[range][0].format(format) &&
                            this.endDate.format(format) == this.ranges[range][1].format(format)
                          ) {
                Severity: Major
                Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 1 hr to fix
                app/javascript/jquery.ui.daterangepicker.js on lines 1628..1640

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

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

                  onAdd() {
                    this.div = document.createElement("div");
                    this.div.style.position = "absolute";
                    this.div.style.cursor = "pointer";
                    this.div.title = this.title;
                Severity: Minor
                Found in app/javascript/react/components/Map/Markers/CustomMarker.tsx - About 1 hr to fix

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

                            if (
                              this.startDate.format("YYYY-MM-DD") ==
                                this.ranges[range][0].format("YYYY-MM-DD") &&
                              this.endDate.format("YYYY-MM-DD") ==
                                this.ranges[range][1].format("YYYY-MM-DD")
                  Severity: Major
                  Found in app/javascript/jquery.ui.daterangepicker.js and 1 other location - About 1 hr to fix
                  app/javascript/jquery.ui.daterangepicker.js on lines 1614..1625

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

                  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

                      builder.addCase(fetchMeasurements.pending, (state) => {
                        state.status = StatusEnum.Pending;
                        state.error = null;
                        state.isLoading = true;
                      });
                  Severity: Major
                  Found in app/javascript/react/store/fixedStreamSlice.ts and 2 other locations - About 1 hr to fix
                  app/javascript/react/store/fixedStreamSlice.ts on lines 152..156
                  app/javascript/react/store/mobileStreamSlice.ts on lines 106..110

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

                  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

                      builder.addCase(fetchMobileStreamById.pending, (state) => {
                        state.status = StatusEnum.Pending;
                        state.error = null;
                        state.isLoading = true;
                      });
                  Severity: Major
                  Found in app/javascript/react/store/mobileStreamSlice.ts and 2 other locations - About 1 hr to fix
                  app/javascript/react/store/fixedStreamSlice.ts on lines 152..156
                  app/javascript/react/store/fixedStreamSlice.ts on lines 175..179

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

                  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

                      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 and 2 other locations - About 1 hr to fix
                  app/javascript/react/store/fixedStreamSlice.ts on lines 175..179
                  app/javascript/react/store/mobileStreamSlice.ts on lines 106..110

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

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

                  export const initializeSentry = () => {
                    let sentryEnvironment: string;
                  
                    switch (window.location.hostname) {
                      case "aircasting.habitatmap.org":
                  Severity: Minor
                  Found in app/javascript/react/utils/initializeSentry.ts - About 1 hr to fix

                    Method sync has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def sync(session_data)
                        tag_list = session_data[:tag_list] || ''
                        session_data =
                          session_data.merge(tag_list: SessionBuilder.normalize_tags(tag_list))
                    
                    
                    Severity: Minor
                    Found in app/models/session.rb - About 1 hr to fix

                      Function handleSliderClick has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const handleSliderClick = (
                          event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>
                        ) => {
                          if (sliderRef.current && activeInput === null) {
                            const rect = sliderRef.current.getBoundingClientRect();
                      Severity: Minor
                      Found in app/javascript/react/utils/thresholdEventHandlers.ts - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language