osbridge/openconferenceware

View on GitHub

Showing 90 of 90 total issues

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

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

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

              def update
                respond_to do |format|
                  if @schedule_item.update_attributes(schedule_item_params)
                    flash[:notice] = 'ScheduleItem was successfully updated.'
                    format.html { redirect_to(@schedule_item) }
          app/controllers/open_conference_ware/session_types_controller.rb on lines 70..80

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

          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 update
                respond_to do |format|
                  if @session_type.update_attributes(session_type_params)
                    flash[:notice] = 'Session type was successfully updated.'
                    format.html { redirect_to(@session_type) }
          app/controllers/open_conference_ware/schedule_items_controller.rb on lines 71..81

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

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

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

                  def create
                    @track = @event.tracks.new(track_params)
              
                    respond_to do |format|
                      if @track.save
              Severity: Major
              Found in app/controllers/open_conference_ware/tracks_controller.rb and 1 other location - About 1 hr to fix
              app/controllers/open_conference_ware/rooms_controller.rb on lines 55..65

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

              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 create
                    @room = @event.rooms.new(room_params)
              
                    respond_to do |format|
                      if @room.save
              Severity: Major
              Found in app/controllers/open_conference_ware/rooms_controller.rb and 1 other location - About 1 hr to fix
              app/controllers/open_conference_ware/tracks_controller.rb on lines 51..61

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

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

                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
                  Severity
                  Category
                  Status
                  Source
                  Language