osbridge/openconferenceware

View on GitHub

Showing 66 of 90 total issues

Function bind_proposal_generic_control has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function bind_proposal_generic_control(kind, elements) {
  if (! elements) {
    elements = $('.proposal_'+kind+'_control');
  }
  elements.removeAttr('disabled').change(function(event) {
Severity: Minor
Found in app/assets/javascripts/open_conference_ware/proposals.js - About 1 hr to fix

    Method to_s_raw has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def to_s_raw
          # Assume one date only, equal start/end
          start_format_list = [nil, :wday, :month, :day, :year, :at, :hour, :min, :suffix, nil]
    
          start_details = time_details(@start_time)
    Severity: Minor
    Found in app/helpers/open_conference_ware/time_range_helper.rb - About 1 hr to fix

      Method user_favorites_contention_report has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def user_favorites_contention_report
        # Prepare
        event = OpenConferenceWare::Event.current
        proposals = event.proposals.accepted
      
      
      Severity: Minor
      Found in util/user_favorites_contention_report.rb - About 1 hr 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 time_details has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def time_details(t)
            # Get the parts for formatting this time, as a hash of
            # strings: keys (roughly) match the equivalent methods on DateTime, but only
            # relevant keys will be filled in. If relative is true (the default):
            # - if it's today, tomorrow, or yesterday, :wday will be eg "today"
      Severity: Minor
      Found in app/helpers/open_conference_ware/time_range_helper.rb - About 1 hr 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 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def update
            # @proposal and @event set via #assign_proposal_and_event filter
      
            # If proposal title editing is locked, prevent non-admin from modifying title.
            if params[:proposal] && @event.proposal_titles_locked? && ! admin?
      Severity: Minor
      Found in app/controllers/open_conference_ware/proposals_controller.rb - About 1 hr to fix

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

            def index
              warn_about_incomplete_event
        
              @kind = :proposals
        
        
        Severity: Minor
        Found in app/controllers/open_conference_ware/proposals_controller.rb - About 1 hr 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 user_favorites_contention_report has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def user_favorites_contention_report
          # Prepare
          event = OpenConferenceWare::Event.current
          proposals = event.proposals.accepted
        
        
        Severity: Minor
        Found in util/user_favorites_contention_report.rb - About 1 hr to fix

          Method related_proposals has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def related_proposals(some_proposals)
                [].tap do |related|
                  parent = self.parent_or_self
                  for proposal in some_proposals
                    catch :found do
          Severity: Minor
          Found in app/models/open_conference_ware/event.rb - About 1 hr 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 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def index
                unless @event
                  flash[:failure] = "Can't display selector votes without an event!"
                  return redirect_back_or_to(root_path)
                end
          Severity: Minor
          Found in app/controllers/open_conference_ware/selector_votes_controller.rb - About 1 hr to fix

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

                def get_current_event_and_assignment_status
                  invalid = false
            
                  # Try finding event using params:
                  event_id_key = controller_name == "events" ? :id : :event_id
            Severity: Minor
            Found in app/controllers/open_conference_ware/application_controller.rb - About 1 hr to fix

              Method to_icalendar has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.to_icalendar(items, opts={})
                    title = opts[:title] || "Schedule"
                    url_helper = opts[:url_helper]
              
                    calendar = Vpim::Icalendar.create2(Vpim::PRODID)
              Severity: Minor
              Found in app/models/open_conference_ware/proposal.rb - About 1 hr to fix

                Method subnav_kind has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def subnav_kind
                      if @event
                        if @event.proposal_status_published?
                          proposal_related_action? ? :proposals : :sessions
                        else
                Severity: Minor
                Found in app/helpers/open_conference_ware/application_helper.rb - About 1 hr 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 base_show has a Cognitive Complexity of 10 (exceeds 5 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

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

                    def self.load_from_fixtures(overwrite = false)
                      [].tap do |records|
                        data = YAML::load(ERB.new(File.read(OpenConferenceWare::Engine.root.join("spec", "fixtures", "open_conference_ware_snippets.yml"))).result(binding))
                        for attributes in data.values
                          record = self.find_by_slug(attributes["slug"].to_s)
                Severity: Minor
                Found in app/models/open_conference_ware/snippet.rb - About 1 hr 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 can_edit? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def can_edit?(record)
                      raise ArgumentError, "No record specified" unless record
                
                      if logged_in?
                        if current_user.admin?
                Severity: Minor
                Found in app/controllers/open_conference_ware/application_controller.rb - About 1 hr 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 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

                  Function activate_menu_item has 27 lines of code (exceeds 25 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 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 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

                      Severity
                      Category
                      Status
                      Source
                      Language