ari/jobsworth

View on GitHub

Showing 267 of 327 total issues

Avoid too many return statements within this function.
Open

  if (240 == so && 240 == wo) return 'Asia/Dubai';
Severity: Major
Found in app/assets/javascripts/tz.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      if (390 == so && 390 == wo) return 'Asia/Rangoon';
    Severity: Major
    Found in app/assets/javascripts/tz.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        if (600 == so && 600 == wo) return 'Australia/Brisbane';
      Severity: Major
      Found in app/assets/javascripts/tz.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          if (60 == so && 0 == wo) return 'Europe/London';
        Severity: Major
        Found in app/assets/javascripts/tz.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            if (345 == so && 345 == wo) return 'Asia/Katmandu';
          Severity: Major
          Found in app/assets/javascripts/tz.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              if (570 == so && 570 == wo) return 'Australia/Darwin';
            Severity: Major
            Found in app/assets/javascripts/tz.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                if (720 == so && 780 == wo) return 'Pacific/Auckland';
              Severity: Major
              Found in app/assets/javascripts/tz.js - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return 'tasks.milestone_id'
                Severity: Major
                Found in app/models/task_filter.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return "#{ class_type.downcase }_id"
                  Severity: Major
                  Found in app/models/task_filter.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                          return render :json => {:billable => false}
                    Severity: Major
                    Found in app/controllers/tasks_controller.rb - About 30 mins to fix

                      Method compose_sql has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def compose_sql(arg1, arg2)
                          if arg1.blank?
                            if arg2.blank?
                              ''
                            else
                      Severity: Minor
                      Found in app/models/task_filter.rb - About 25 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 changes_as_html has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def changes_as_html
                          res = []
                          type = resource_type_attribute
                      
                          self.changes.each do |name, values|
                      Severity: Minor
                      Found in app/models/resource_attribute.rb - About 25 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_custom_attribute_values= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def set_custom_attribute_values=(params)
                          updated = []
                          existing = custom_attribute_values.clone.to_a
                      
                          params.each do |values|
                      Severity: Minor
                      Found in app/models/custom_attribute_methods.rb - About 25 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 clean_body has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def self.clean_body(body)
                            new_body_end = body.to_s.index(Mailman::BODY_SPLIT) || body.to_s.length
                            body = body.to_s[0, new_body_end].strip
                      
                            lines = body.to_s.split("\n")
                      Severity: Minor
                      Found in app/models/mailman.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def update
                          @resource = current_user.company.resources.find(params[:id])
                          @resource.attributes = resource_attributes
                          @resource.company = current_user.company
                          log = log_resource_changes(@resource)
                      Severity: Minor
                      Found in app/controllers/resources_controller.rb - About 25 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 destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def destroy
                          filter = current_user.company.task_filters.find(params[:id])
                      
                          if (filter.user == current_user) ||
                              (filter.shared? and current_user.admin?)
                      Severity: Minor
                      Found in app/controllers/task_filters_controller.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def initialize(controller, params)
                          tasks = []
                          if params[:filter_project].to_i > 0
                            tasks = Project.find(params[:filter_project]).tasks
                          else
                      Severity: Minor
                      Found in app/models/worklog_report.rb - About 25 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 users_to_notify_popup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def users_to_notify_popup
                          # anyone already attached to the task should be removed
                          excluded_ids = params[:watcher_ids].blank? ? 0 : params[:watcher_ids]
                          @users = current_user.customer ? current_user.customer.users.active.where("id NOT IN (#{excluded_ids})").order('name').limit(50) : []
                          @task = AbstractTask.accessed_by(current_user).find_by(:id => params[:id])
                      Severity: Minor
                      Found in app/controllers/tasks_controller.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def update
                          update_existing_property_values(@property)
                          not_empty_property_value = new_property_values_attributes[0]['value'] if new_property_values_attributes.present?
                          @property.property_values.build(new_property_values_attributes) if not_empty_property_value.present?
                      
                      
                      Severity: Minor
                      Found in app/controllers/properties_controller.rb - About 25 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 name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def name
                          n = "#{self.scm_project.scm_type.upcase} Commit"
                          if self.scm_project.scm_type == 'svn'
                            n << " (r#{self.changeset_rev})"
                          end
                      Severity: Minor
                      Found in app/models/scm_changeset.rb - About 25 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