estimancy/projestimate

View on GitHub

Showing 836 of 1,675 total issues

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

  def validate_change_with_children
    begin
      wbs_activity = WbsActivity.find(params[:id])
      wbs_activity_root_element = WbsActivityElement.where('wbs_activity_id = ? and is_root = ?', wbs_activity.id, true).first

Severity: Minor
Found in app/controllers/wbs_activities_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 get_label_widget_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def get_label_widget_data(view_widget_id)
    view_widget = ViewsWidget.find(view_widget_id)
    widget_data = {}
    initial_width = 60;  initial_height = 60
    value_to_show = nil # according to the widget type
Severity: Minor
Found in app/helpers/views_widgets_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_organization_estimation_statuses has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def update_organization_estimation_statuses
    @estimation_statuses = []

    unless params[:project_organization_id].nil? || params[:project_organization_id].blank?
      @organization = Organization.find(params[:project_organization_id])
Severity: Minor
Found in app/controllers/projects_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 column_value has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def column_value(column, project, value)
    case column.name
      when :product_name
        content_tag('td class="text_field_text_overflow exportable"', project.root_component)
      when :title
Severity: Minor
Found in app/helpers/organizations_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 set_project_version has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def set_project_version(project_to_checkout)
    #No authorize is required as method is private and could not be accessed by any route
    new_version = ''
    parent_version = project_to_checkout.version

Severity: Minor
Found in app/controllers/projects_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 admin_setting_selected_status has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def admin_setting_selected_status
    begin
      #No authorize required since this method is protected and won't be call from any route
      selected = nil
      @admin_setting = AdminSetting.find(params[:id])  unless params[:id].nil?
Severity: Minor
Found in app/controllers/admin_settings_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 select has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  select: function(id, name, index) {
    if(!this.config.selectOnHover) return;
    var s = this.selected;
    if(s.id != id || s.name != name 
        || s.index != index) {
Severity: Minor
Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

    Function placeLabel has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        placeLabel: function(tag, node, controller) {
          var pos = node.pos.getc(true), viz = this.viz, canvas = this.viz.canvas;
          var radius = canvas.getSize();
          var labelPos = {
            x: Math.round(pos.x + radius.width / 2),
    Severity: Minor
    Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

      Function interpolate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          interpolate: function(elem, delta) {
              var pi = Math.PI, pi2 = pi * 2;
              var ch = function(t) {
                  var a =  (t < 0)? (t % pi2) + pi2 : t % pi2;
                  return a;
      Severity: Minor
      Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

        Function contains has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            'contains': function(node, mpos) {
              var pos = node.pos.getc(true), 
                  width = node.getData('width'),
                  height = node.getData('height'),
                  algnPos = this.getAlignedPos(pos, width, height),
        Severity: Minor
        Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

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

              'render': function(node, canvas, animating) {
                var config = this.viz.config;
                var offset = config.offset;
                var width = node.getData('width');
                var height = node.getData('height');
          Severity: Minor
          Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

            Function select has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    select: function(id, onComplete) {
                        var group = this.group, geom = this.geom;
                        var node=  this.graph.getNode(id), canvas = this.canvas;
                        var root  = this.graph.getNode(this.root);
                        var complete = $.merge(this.controller, onComplete);
            Severity: Minor
            Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

              Function continueFunction has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                                              var continueFunction = function() {
                                                  // remove this jpc from the current endpoint
                                                  jpc.endpoints[idx].detachFromConnection(jpc);
                                                  if (jpc.suspendedEndpoint) jpc.suspendedEndpoint.detachFromConnection(jpc);
                                                  jpc.endpoints[idx] = self;
              Severity: Minor
              Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

                Function sortText has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            ts.sortText = function(table, a, b, col) {
                                if (a === b) { return 0; }
                                var c = table.config, e = c.string[ (c.empties[col] || c.emptyTo ) ],
                                    r = ts.regex, xN, xD, yN, yD, xF, yF, i, mx;
                                if (a === '' && e !== 0) { return typeof e === 'boolean' ? (e ? -1 : 1) : -e || -1; }
                Severity: Minor
                Found in app/assets/javascripts/pager.js - About 1 hr to fix

                  Function processStyle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function processStyle(styleString) {
                      if (styleString in processStyleCache) {
                        return processStyleCache[styleString];
                      }
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 1 hr to fix

                    Function move_widget_down has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        fn.move_widget_down = function($widget, y_units) {
                            var el_grid_data, actual_row, moved, y_diff;
                    
                            if (y_units <= 0) { return false; }
                    
                    
                    Severity: Minor
                    Found in app/assets/javascripts/jquery.gridster.js - About 1 hr to fix

                      Function next_position has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          fn.next_position = function(size_x, size_y) {
                              size_x || (size_x = 1);
                              size_y || (size_y = 1);
                              var ga = this.gridmap;
                              var cols_l = ga.length;
                      Severity: Minor
                      Found in app/assets/javascripts/jquery.gridster.js - About 1 hr to fix

                        Function move_widget_up has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            fn.move_widget_up = function($widget, y_units) {
                                var el_grid_data = $widget.coords().grid;
                                var actual_row = el_grid_data.row;
                                var moved = [];
                                var can_go_up = true;
                        Severity: Minor
                        Found in app/assets/javascripts/jquery.gridster.js - About 1 hr to fix

                          Function moveMonth has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  moveMonth: function(date, dir){
                                      if (!dir) return date;
                                      var new_date = new Date(date.valueOf()),
                                          day = new_date.getUTCDate(),
                                          month = new_date.getUTCMonth(),
                          Severity: Minor
                          Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix

                            Method generate_activity_element_tree has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def generate_activity_element_tree(element, tree)
                                #Root is always display
                                tree ||= String.new
                                unless element.nil?
                                  if element.is_root?
                            Severity: Minor
                            Found in app/helpers/wbs_activity_elements_helper.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language