osbridge/openconferenceware

View on GitHub

Showing 66 of 90 total issues

Method accept_and_reject_from_spreadsheet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def accept_and_reject_from_spreadsheet
  # Paste IDs from spreadsheet, separated by spaces
  #             ↓↓↓
  reject =   %w(   ).map(&:to_i)
  accept =   %w(   ).map(&:to_i)
Severity: Minor
Found in util/update_proposal_status_from_voting_spreadsheet.rb - About 55 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

Avoid deeply nested control flow statements.
Open

        for item in block.items
          puts "          - BlockItem: #{item.title} -- #{item.start_time.to_s(:time)} to #{item.end_time.to_s(:time)}"
        end
Severity: Major
Found in util/schedule_demo.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              while coverage_details_page.title.include?('Working')
                coverage_details_page = agent.get(coverage_details_page.uri)
              end
    Severity: Major
    Found in util/sessions_to_lanyrd.rb - About 45 mins to fix

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

          def create
            @selector_vote = SelectorVote.find_or_initialize_by(user_id: current_user.id, proposal_id: params[:proposal_id].to_i)
            @selector_vote.assign_attributes(selector_vote_params)
      
            respond_to do |format|
      Severity: Minor
      Found in app/controllers/open_conference_ware/selector_votes_controller.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

      Avoid deeply nested control flow statements.
      Open

                if existing_topics.size < 5
                  session.tags[0..6].each do |tag|
                    next if existing_topics.size == 5 || existing_topics.include?(tag.to_s.downcase.strip.gsub(' ',''))
                    puts "    - Adding topic: #{tag}"
                    topic_search_page = agent.get(session_page.uri.to_s + "topics/?q=#{tag}")
      Severity: Major
      Found in util/sessions_to_lanyrd.rb - About 45 mins to fix

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

            def update
              if admin? or can_edit?(@user)
                if params[:require_complete_profile]
                  @user.complete_profile = true
                end
        Severity: Minor
        Found in app/controllers/open_conference_ware/users_controller.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

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

              def update
                @return_to = params[:return_to]
        
                respond_to do |format|
                  if @event.update_attributes(event_params)
        Severity: Minor
        Found in app/controllers/open_conference_ware/manage/events_controller.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

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

            def assert_proposal_status_published
              display = false
              if @event.proposal_status_published?
                display = true
              else
        Severity: Minor
        Found in app/controllers/open_conference_ware/application_controller.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

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

              def update
                @snippet = Snippet.find(params[:id])
                add_breadcrumb @snippet.slug, manage_snippet_path(@snippet)
        
                @return_to = params[:return_to]
        Severity: Minor
        Found in app/controllers/open_conference_ware/manage/snippets_controller.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

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

            def index
              @user_favorites = Defer {
                view_cache_key = "favorites,user_#{@user.id}.#{request.format},join_#{params[:join]}"
                Rails.cache.fetch(view_cache_key) {
                  # The :join argument is sent by the AJAX UI to fetch a terse list of
        Severity: Minor
        Found in app/controllers/open_conference_ware/user_favorites_controller.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

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

            def create
              if params[:quagmire].present?
                flash[:failure] = "Comment rejected because you're behaving like a robot, please leave the 'Leave blank' field blank."
                redirect_to(:back) rescue redirect_to proposals_path()
                return
        Severity: Minor
        Found in app/controllers/open_conference_ware/comments_controller.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

        Function activate_menu_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function activate_menu_item () {
            var should_log = false;
        
            var debug = function (message) {
              if(should_log && (typeof console == "object")) console.log('activate_menu_item: ' + message);
        Severity: Minor
        Found in app/assets/javascripts/open_conference_ware/menu.js - 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

        Avoid deeply nested control flow statements.
        Open

                  while coverage_details_page.title.include?('Working')
                    coverage_details_page = agent.get(coverage_details_page.uri)
                  end
        Severity: Major
        Found in util/sessions_to_lanyrd.rb - About 45 mins to fix

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

              def assert_schedule_published
                display = admin? || schedule_visible?
                flash[:notice] = "The schedule has not yet been published, only admins can see this page." if admin? && !schedule_visible?
          
                unless display
          Severity: Minor
          Found in app/controllers/open_conference_ware/application_controller.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

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

            def allocate_rooms
              @sessions.each do |session|
                next if session.room.present?
                first_available_room = @rooms.find{|room| room_available_at?(room, session.start_time)}
                if first_available_room.present?
          Severity: Minor
          Found in util/assign_rooms.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

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

              def get_proposal_and_assignment_status
                if proposal = Proposal.find(params[:id].to_i) rescue nil
                  if proposal.event
                    return [proposal, :assigned_via_param]
                  else
          Severity: Minor
          Found in app/controllers/open_conference_ware/proposals_controller.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

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

              def sort_link_for(label, field, kind=nil)
                kind ||= @kind
          
                opts = {sort: field}
                opts[:dir] = 'desc' if ( field == params[:sort] && params[:dir] != 'desc' )
          Severity: Minor
          Found in app/helpers/open_conference_ware/proposals_helper.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

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

              def initialize(start_time, end_time=nil, opts=nil)
                # Initialize with a single DateTime, a pair of DateTimes,
                # or an object that responds_to start_time and end_time, and
                # several options
                #
          Severity: Minor
          Found in app/helpers/open_conference_ware/time_range_helper.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

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

              def index
                @comments = Comment.listable
                add_breadcrumb "Comments", comments_path()
          
                if [:atom, :json, :xml].include?(request.format.to_sym)
          Severity: Minor
          Found in app/controllers/open_conference_ware/comments_controller.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

          Avoid too many return statements within this method.
          Open

                  return false
          Severity: Major
          Found in app/controllers/open_conference_ware/application_controller.rb - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language