rubycentral/cfp-app

View on GitHub

Showing 46 of 126 total issues

Function render has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const {
      dayViewing,
      startTime,
      endTime,
Severity: Minor
Found in app/javascript/components/Schedule/DayView.js - About 1 hr to fix

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

      def incomplete_checklist_items
        missing_items = []
    
        missing_items << "Event must have a url" unless url.present?
        missing_items << "Event must have a start date" unless start_date
    Severity: Minor
    Found in app/models/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 create_from_proposal has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.create_from_proposal(proposal)
        self.transaction do
          ps = ProgramSession.create!(event_id: proposal.event_id,
                                      proposal_id: proposal.id,
                                      title: proposal.title,
    Severity: Minor
    Found in app/models/program_session.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 self has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var self = function(number, varargs) {
          number |= 0;
          if (!number) {
            return [];
          }
    Severity: Minor
    Found in app/assets/javascripts/palette.js - About 1 hr to fix

      Method website_params has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def website_params
          params
            .require(:website)
            .permit(
              :logo,
      Severity: Minor
      Found in app/controllers/staff/websites_controller.rb - About 1 hr to fix

        Function render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render() {
            const { sessions, unscheduledSessions, tracks } = this.props;
            const { searchInput, isHidden } = this.state;
            let display = isHidden ? 'none' : '';
            let filteredSessions = unscheduledSessions.filter((session) => {
        Severity: Minor
        Found in app/javascript/components/Schedule/UnscheduledArea.js - About 1 hr to fix

          Function initTimeSlot has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function initTimeSlot($slot) {
              $slot.css({
                height: ($slot.data('duration') * verticalScale) + 'px',
                top: (($slot.data('starts') - dayStart) * verticalScale) + 'px'
              });
          Severity: Minor
          Found in app/assets/javascripts/staff/program/grid.js - About 1 hr to fix

            Function initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              initialize () {
                this.tinyMCEDefaults = {
                  height: 500,
                  menubar: false,
                  plugins: [
            Severity: Minor
            Found in app/javascript/controllers/editor_controller.js - About 1 hr to fix

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

                def after_sign_in_path_for(user)
                  if session[:pending_invite_accept_url]
                    session[:pending_invite_accept_url]
                  elsif !user.complete?
                    edit_profile_path
              Severity: Minor
              Found in app/controllers/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

              Function listSchemes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                palette.listSchemes = function(name, opt_number) {
                  if (!opt_number) {
                    opt_number = 2;
                  } else if (opt_number < 0) {
                    opt_number = -opt_number;
              Severity: Minor
              Found in app/assets/javascripts/palette.js - About 1 hr to fix

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

                  def embed(body)
                    body.tap do |body|
                      TAGS.each do |tag, template|
                        body.gsub!(tag) do
                          args = tag.is_a?(Regexp) ? extract($1) : {}
                Severity: Minor
                Found in app/helpers/page_helper.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 from_omniauth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.from_omniauth(auth, invitation_email=nil)
                    where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
                      password = Devise.friendly_token[0,20]
                      user.name = auth['info']['name'] if user.name.blank?
                      user.email = invitation_email || auth['info']['email'] || '' if user.email.blank?
                Severity: Minor
                Found in app/models/user.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 set_cache_headers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def set_cache_headers
                    return unless Rails.configuration.action_controller.perform_caching
                
                    server_cache_age =
                      current_website.caching_off? ? 0 : ENV.fetch('CACHE_CONTROL_S_MAXAGE', 1.week)
                Severity: Minor
                Found in app/controllers/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 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

                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

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