HabitatMap/AirCasting

View on GitHub

Showing 667 of 667 total issues

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

          } else {
            monthHtml +=
              "<option value='" +
              m +
              "'" +
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 848..857

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

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

          ) {
            monthHtml +=
              "<option value='" +
              m +
              "'" +
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 857..866

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

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

      (state, action: PayloadAction<FixedStream>) => {
        state.status = StatusEnum.Fulfilled;
        state.data = action.payload;
        state.isLoading = false;
        state.error = null;
Severity: Major
Found in app/javascript/react/store/fixedStreamSlice.ts and 1 other location - About 1 hr to fix
app/javascript/react/store/crowdMapSlice.ts on lines 78..83

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

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

        (state, action: PayloadAction<RectangleData[]>) => {
          state.status = StatusEnum.Fulfilled;
          state.rectangles = action.payload;
          state.fetchingData = false;
          state.error = null;
Severity: Major
Found in app/javascript/react/store/crowdMapSlice.ts and 1 other location - About 1 hr to fix
app/javascript/react/store/fixedStreamSlice.ts on lines 159..164

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

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

    it 'returns sessions that started before the range and ended in the minutes range' do
      session =
        create_session(
          start_time: Time.new(2_010, 1, 2, 1, 1),
          end_time: Time.new(2_010, 1, 2, 1, 3)
Severity: Major
Found in spec/models/session_spec.rb and 3 other locations - About 1 hr to fix
spec/models/session_spec.rb on lines 90..104
spec/models/session_spec.rb on lines 107..121
spec/models/session_spec.rb on lines 141..155

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

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

    it 'returns sessions that started in the range and ended after the minutes range' do
      session =
        create_session(
          start_time: Time.new(2_010, 1, 2, 1, 2),
          end_time: Time.new(2_010, 1, 2, 1, 4)
Severity: Major
Found in spec/models/session_spec.rb and 3 other locations - About 1 hr to fix
spec/models/session_spec.rb on lines 90..104
spec/models/session_spec.rb on lines 124..138
spec/models/session_spec.rb on lines 141..155

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

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

    it 'returns sessions that started and ended in the minutes range' do
      session =
        create_session(
          start_time: Time.new(2_010, 1, 2, 1, 2),
          end_time: Time.new(2_010, 1, 2, 1, 3)
Severity: Major
Found in spec/models/session_spec.rb and 3 other locations - About 1 hr to fix
spec/models/session_spec.rb on lines 107..121
spec/models/session_spec.rb on lines 124..138
spec/models/session_spec.rb on lines 141..155

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

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

    it 'returns sessions that started before the range and ended after the minutes range' do
      session =
        create_session(
          start_time: Time.new(2_010, 1, 2, 1, 1),
          end_time: Time.new(2_010, 1, 2, 1, 4)
Severity: Major
Found in spec/models/session_spec.rb and 3 other locations - About 1 hr to fix
spec/models/session_spec.rb on lines 90..104
spec/models/session_spec.rb on lines 107..121
spec/models/session_spec.rb on lines 124..138

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

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

var EventManager = new (function () {
  var events = {};
  var happened = [];

  this.publish = function (name, data) {
Severity: Minor
Found in app/javascript/javascript/pubsub.js - About 1 hr to fix

    Function updateView has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        updateView: function () {
          if (this.timePicker) {
            this.renderTimePicker("left");
            this.renderTimePicker("right");
            if (!this.endDate) {
    Severity: Minor
    Found in app/javascript/jquery.ui.daterangepicker.js - About 1 hr to fix

      Method up has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def up
          Session.transaction do
            Session
              .all
              .select { |s| !s.timezone_offset }
      Severity: Minor
      Found in db/migrate/20120220090451_fix_missing_timezones.rb - About 1 hr to fix

        Function YearPickerButtons has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const YearPickerButtons = () => {
          const dispatch = useAppDispatch();
          const { timeFrom, updateTime } = useMapParams();
        
          const handleYear = useCallback(

          Consider simplifying this complex logical expression.
          Open

                  if (
                    !this.singleDatePicker &&
                    this.leftCalendar.month &&
                    this.rightCalendar.month &&
                    (this.startDate.format("YYYY-MM") ==
          Severity: Major
          Found in app/javascript/jquery.ui.daterangepicker.js - About 1 hr to fix

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

              streams: {
                [key: string]: {
                  streamDailyAverage: number;
                  measurementShortType: string;
                  sensorName: string;
            Severity: Major
            Found in app/javascript/react/store/indoorSessionsSlice.ts and 1 other location - About 1 hr to fix
            app/javascript/react/store/fixedSessionsSlice.ts on lines 22..30

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

            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

              const updateLimit = useCallback(
                (newLimit: number) => {
                  setUrlParams([{ key: UrlParamsTypes.limit, value: newLimit.toString() }]);
                },
                [setUrlParams]
            Severity: Major
            Found in app/javascript/react/utils/mapParamsHandler.ts and 2 other locations - About 1 hr to fix
            app/javascript/react/utils/mapParamsHandler.ts on lines 159..166
            app/javascript/react/utils/mapParamsHandler.ts on lines 171..181

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

            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

              streams: {
                [key: string]: {
                  streamDailyAverage: number;
                  measurementShortType: string;
                  sensorName: string;
            Severity: Major
            Found in app/javascript/react/store/fixedSessionsSlice.ts and 1 other location - About 1 hr to fix
            app/javascript/react/store/indoorSessionsSlice.ts on lines 21..29

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

            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

              const updateOffset = useCallback(
                (newOffset: number) => {
                  setUrlParams([
                    { key: UrlParamsTypes.offset, value: newOffset.toString() },
                  ]);
            Severity: Major
            Found in app/javascript/react/utils/mapParamsHandler.ts and 2 other locations - About 1 hr to fix
            app/javascript/react/utils/mapParamsHandler.ts on lines 142..147
            app/javascript/react/utils/mapParamsHandler.ts on lines 171..181

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

            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

              const updateFetchedSessions = useCallback(
                (newFetchedSessions: number) => {
                  setUrlParams([
                    {
                      key: UrlParamsTypes.fetchedSessions,
            Severity: Major
            Found in app/javascript/react/utils/mapParamsHandler.ts and 2 other locations - About 1 hr to fix
            app/javascript/react/utils/mapParamsHandler.ts on lines 142..147
            app/javascript/react/utils/mapParamsHandler.ts on lines 159..166

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

            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

                def export_by_uuid
                  GoogleAnalyticsWorker::RegisterEvent.async_call(
                    'Measurement Sessions#export'
                  )
            
            
            Severity: Major
            Found in app/controllers/api/measurement_sessions_controller.rb and 2 other locations - About 1 hr to fix
            app/controllers/api/measurement_sessions_controller.rb on lines 35..53
            app/controllers/api/measurements_controller.rb on lines 5..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 47.

            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

                def export
                  GoogleAnalyticsWorker::RegisterEvent.async_call(
                    'Measurement Sessions#export'
                  )
            
            
            Severity: Major
            Found in app/controllers/api/measurement_sessions_controller.rb and 2 other locations - About 1 hr to fix
            app/controllers/api/measurement_sessions_controller.rb on lines 56..74
            app/controllers/api/measurements_controller.rb on lines 5..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 47.

            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