osbridge/openconferenceware

View on GitHub

Showing 90 of 90 total issues

Method create has 27 lines of code (exceeds 25 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 1 hr to fix

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

        def base_show
          if selector? && @event.accept_selector_votes?
            @selector_vote = @proposal.selector_votes.find_or_initialize_by(user_id: current_user.id)
          end
    
    
    Severity: Minor
    Found in app/controllers/open_conference_ware/proposals_controller.rb - About 1 hr to fix

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

          def create
            @proposal = @event.proposals.new(proposal_params)
            @proposal.add_user(current_user) if logged_in?
            @proposal.transition = transition_from_params if admin?
      
      
      Severity: Minor
      Found in app/controllers/open_conference_ware/proposals_controller.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

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

              respond_to do |format|
                if @snippet.update_attributes(snippet_params)
                  flash[:notice] = 'Snippet was successfully updated.'
                  format.html { redirect_to(@return_to ? @return_to : [:manage, @snippet]) }
                  format.xml  { head :ok }
      app/controllers/open_conference_ware/manage/events_controller.rb on lines 76..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 45.

      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

              respond_to do |format|
                if @event.update_attributes(event_params)
                  flash[:notice] = 'Event was successfully updated.'
                  format.html { redirect_to(@return_to ? @return_to : [:manage, @event]) }
                  format.xml  { head :ok }
      app/controllers/open_conference_ware/manage/snippets_controller.rb on lines 77..84

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 45.

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

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

          def assert_user
            case self
            when UsersController
              user_id = params[:id]
            when UserFavoritesController
      Severity: Minor
      Found in app/controllers/open_conference_ware/application_controller.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

      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

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

        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

          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

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

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

            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
                      @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 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

              Severity
              Category
              Status
              Source
              Language