rubycentral/cfp-app

View on GitHub

Showing 126 of 126 total issues

Method finalize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def finalize
    transaction do
      update_state(SOFT_TO_FINAL[state]) if SOFT_TO_FINAL.key?(state)
      if becomes_program_session?
        ps = ProgramSession.create_from_proposal(self)
Severity: Minor
Found in app/models/proposal.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  def speaker_notification(proposal, comment, users)
    @proposal = proposal
    @comment = comment

    to = users.map(&:email).reject{|e| e.blank? }
Severity: Minor
Found in app/mailers/comment_notification_mailer.rb and 1 other location - About 40 mins to fix
app/mailers/comment_notification_mailer.rb on lines 3..14

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

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

  def reviewer_notification(proposal, comment, users)
    @comment = comment
    @proposal = proposal

    # Email all reviewers of this proposal if notifications is true unless they made the comment
Severity: Minor
Found in app/mailers/comment_notification_mailer.rb and 1 other location - About 40 mins to fix
app/mailers/comment_notification_mailer.rb on lines 18..27

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

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

  $('.cancel-status-change').click(function() {
    $('.status-dropdown').hide();
    $('.btn-nav').show();
  });
Severity: Minor
Found in app/assets/javascripts/staff/events.js and 2 other locations - About 40 mins to fix
app/assets/javascripts/proposal.js on lines 56..59
app/assets/javascripts/staff/events.js on lines 2..5

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

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

  $('#cancel-tags-editing').click(function() {
    $('#review-tags-form-wrapper').toggle();
    $('.proposal-reviewer-tags, #edit-tags-icon').toggle();
  });
Severity: Minor
Found in app/assets/javascripts/proposal.js and 2 other locations - About 40 mins to fix
app/assets/javascripts/staff/events.js on lines 2..5
app/assets/javascripts/staff/events.js on lines 7..10

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

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

  $('.status-button').click(function() {
    $('.status-dropdown').show();
    $('.btn-nav').hide();
  });
Severity: Minor
Found in app/assets/javascripts/staff/events.js and 2 other locations - About 40 mins to fix
app/assets/javascripts/proposal.js on lines 56..59
app/assets/javascripts/staff/events.js on lines 7..10

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

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 postBulkTimeSlots has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

export function postBulkTimeSlots(path, day, rooms, duration, startTimes) {
Severity: Minor
Found in app/javascript/apiCalls.js - About 35 mins to fix

    Function withColorFunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      palette.Scheme.withColorFunction = function(name, groups,
                                                  func, opt_is_cbf, opt_cyclic) {
    Severity: Minor
    Found in app/assets/javascripts/palette.js - About 35 mins to fix

      Function fromPalettes has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        palette.Scheme.fromPalettes = function(name, groups,
                                               palettes, opt_max, opt_cbf_max) {
      Severity: Minor
      Found in app/assets/javascripts/palette.js - About 35 mins to fix

        Function generate has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          palette.generate = function(color_func, number, opt_start, opt_end,
                                      opt_cyclic) {
        Severity: Minor
        Found in app/assets/javascripts/palette.js - About 35 mins to fix

          Method create_time_slots has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def create_time_slots
              slots = build_time_slots
              TimeSlot.transaction do
                slots.each do |s|
                  unless s.save
          Severity: Minor
          Found in app/models/bulk_time_slot.rb - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

            closeSidePanel() {
              this.sidePanelTarget.classList.remove('open');
              this.sidePanelTarget.classList.add('closed');
            }
          Severity: Minor
          Found in app/javascript/controllers/fly_out_controller.js and 1 other location - About 35 mins to fix
          app/javascript/controllers/fly_out_controller.js on lines 60..63

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

          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

            openSidePanel() {
              this.sidePanelTarget.classList.remove('closed');
              this.sidePanelTarget.classList.add('open');
            }
          Severity: Minor
          Found in app/javascript/controllers/fly_out_controller.js and 1 other location - About 35 mins to fix
          app/javascript/controllers/fly_out_controller.js on lines 55..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 46.

          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

          Avoid too many return statements within this function.
          Open

                  return null;
          Severity: Major
          Found in app/assets/javascripts/palette.js - About 30 mins to fix

            Method proposal_date_range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def proposal_date_range
                now = DateTime.now
                if object.proposals.present? && object.closes_at
                  event_first_proposal_created_at =
                    object.proposals.order(created_at: :asc).pluck(:created_at).first
            Severity: Minor
            Found in app/decorators/event_decorator.rb - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method set_proposal_counts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def set_proposal_counts
                @all_accepted_count ||= current_event.stats.all_accepted_proposals
                @all_waitlisted_count ||= current_event.stats.all_waitlisted_proposals
                unless sticky_selected_track == 'all'
                  @all_accepted_track_count ||= current_event.stats.all_accepted_proposals(sticky_selected_track)
            Severity: Minor
            Found in app/controllers/concerns/program_support.rb - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                if current_user.update(user_params)
            
                  if current_user.unconfirmed_email.present?
                    flash[:danger] = I18n.t("devise.registrations.update_needs_confirmation")
            Severity: Minor
            Found in app/controllers/profiles_controller.rb - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

              def update
                unless @session_format.update(session_format_params)
                  flash.now[:danger] = "There was a problem updating your session format, #{@session_format.errors.full_messages.join(", ")}."
                end
                respond_to do |format|
            Severity: Minor
            Found in app/controllers/staff/session_formats_controller.rb and 1 other location - About 25 mins to fix
            app/controllers/staff/rooms_controller.rb on lines 22..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 30.

            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 unmet_requirements_for_scheduling has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def unmet_requirements_for_scheduling
                missing_prereqs = []
            
                missing_prereqs << "Event must have a start date" unless start_date
                missing_prereqs << "Event must have a end date" unless end_date
            Severity: Minor
            Found in app/models/event.rb - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              render() {
                let { sessionFormats, closeBulkTimeSlotModal, counts } = this.props;
                let { timeError, day, startTimes, duration } = this.state;
            
                const days = Object.keys(counts);
            Severity: Minor
            Found in app/javascript/components/Schedule/BulkCreateModal.js - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Severity
            Category
            Status
            Source
            Language