ari/jobsworth

View on GitHub

Showing 327 of 327 total issues

Method search has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def search
    @filter = params[:term]
    if @filter.blank?
      render :nothing => true
      return
Severity: Major
Found in app/controllers/task_filters_controller.rb - About 3 hrs to fix

    Class TaskRecord has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class TaskRecord < AbstractTask
      has_many :property_values, :through => :task_property_values
    
      scope :from_this_year, lambda { where('created_at > ?', Time.zone.now.beginning_of_year - 1.month) }
      scope :open_only, -> { where(:status => 0) }
    Severity: Minor
    Found in app/models/task_record.rb - About 3 hrs to fix

      File user.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'digest/md5'
      
      class User < ActiveRecord::Base
      
        devise :database_authenticatable, :registerable, :encryptable,
      Severity: Minor
      Found in app/models/user.rb - About 3 hrs to fix

        Method update has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.update(task, params, user)
            old_tags = task.tags.collect { |t| t.name }.sort.join(', ')
            old_deps = task.dependencies.collect { |t| "[#{t.issue_num}] #{t.name}" }.sort.join(', ')
            old_owner = task.owners.first
            old_users = task.owners.collect { |u| u.id }.sort.join(',')
        Severity: Major
        Found in app/models/abstract_task.rb - About 3 hrs to fix

          Method rss has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def rss
              return if params[:id].blank?
          
              headers['Content-Type'] = 'application/rss+xml'
          
          
          Severity: Major
          Found in app/controllers/feeds_controller.rb - About 3 hrs to fix

            File task_filter.rb has 309 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class TaskFilter < ActiveRecord::Base
              # column `name` is of type `VARCHAR(255)`.
              # Note that MySQL 5.x+ and PostgreSQL both track length of "characters" and not "bytes"
              MAXIMUM_NAME_LENGTH = 255
            
            
            Severity: Minor
            Found in app/models/task_filter.rb - About 3 hrs to fix

              Function TaskPropertyEdit has 84 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              jobsworth.TaskPropertyEdit = (function ($) {
              
                function TaskPropertyEdit(options) {
                  this.options = options;
                  this.init();
              Severity: Major
              Found in app/assets/javascripts/task_property_edit.js - About 3 hrs to fix

                Function createGrid has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  Grid.prototype.createGrid = function (rows) {
                    var self = this;
                
                    var options = {
                      enableCellNavigation: true,
                Severity: Major
                Found in app/assets/javascripts/grid.js - About 3 hrs to fix

                  File task_editor.js has 300 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // Place all the behaviors and hooks related to the matching controller here.
                  // All this logic will automatically be available in application.js.
                  
                  var jobsworth = jobsworth || {};
                  jobsworth.tasks = jobsworth.tasks || {};
                  Severity: Minor
                  Found in app/assets/javascripts/tasks/task_editor.js - About 3 hrs to fix

                    Function bindEvents has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      TaskEditor.prototype.bindEvents = function () {
                        var self = this;
                    
                        $(this.taskDetailsEditor.el).on('project:changed', function (e, projectId) {
                          if (projectId == "") return;
                    Severity: Major
                    Found in app/assets/javascripts/tasks/task_editor.js - About 3 hrs to fix

                      Method build_work_added_or_comment has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.build_work_added_or_comment(task, user, params=nil)
                          work_log_params=params[:work_log].nil? ? {} : params[:work_log].clone
                          if (work_log_params and !work_log_params[:duration].blank?) or (params and !params[:comment].blank?)
                            unless params[:comment].blank?
                              work_log_params[:body] = params[:comment]
                      Severity: Minor
                      Found in app/models/work_log.rb - About 3 hrs 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 search has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def search
                          @filter = params[:term]
                          if @filter.blank?
                            render :nothing => true
                            return
                      Severity: Minor
                      Found in app/controllers/task_filters_controller.rb - About 3 hrs 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 to_tip has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def to_tip(options = {})
                          user = options[:user]
                          utz = user.tz
                      
                          unless @tip
                      Severity: Minor
                      Found in app/models/abstract_task.rb - About 3 hrs 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

                      File tasks_helper.rb has 294 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      module TasksHelper
                        def render_task_form(show_timer = true)
                          render partial: 'tasks/form', locals: {show_timer: show_timer}
                        end
                      
                      
                      Severity: Minor
                      Found in app/helpers/tasks_helper.rb - About 3 hrs to fix

                        Method to_html has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def to_html
                            return '' if body.blank?
                        
                            pres = []
                        
                        
                        Severity: Minor
                        Found in app/models/wiki_revision.rb - About 2 hrs 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 get_tz_name has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function get_tz_name() {
                          var so = -1 * (new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0))).getTimezoneOffset();
                          var wo = -1 * (new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0))).getTimezoneOffset();
                        
                          if (-660 == so && -660 == wo) return 'Pacific/Midway';
                        Severity: Major
                        Found in app/assets/javascripts/tz.js - About 2 hrs to fix

                          Function Task has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                          jobsworth.Task = (function ($) {
                            function Task(id) {
                              this.load(id);
                            }
                          
                          
                          Severity: Minor
                          Found in app/assets/javascripts/task.js - About 2 hrs 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 burndown_extracted_from_show has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def burndown_extracted_from_show
                              start, step, interval, range, tick = @widget.calculate_start_step_interval_range_tick(tz)
                              filter = filter_from_filter_by
                          
                              @items = []
                          Severity: Minor
                          Found in app/controllers/widgets_controller.rb - About 2 hrs 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 EmailAddresses has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          jobsworth.EmailAddresses = (function ($) {
                            function EmailAddresses(user_id) {
                              this.user_id = user_id;
                          
                              this.bindEvents();
                          Severity: Major
                          Found in app/assets/javascripts/email_addresses.js - About 2 hrs to fix

                            File widgets_controller.rb has 280 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            class WidgetsController < ApplicationController
                            
                              OVERDUE = 0
                              TODAY = 1
                              TOMORROW = 2
                            Severity: Minor
                            Found in app/controllers/widgets_controller.rb - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language