ari/jobsworth

View on GitHub

Showing 267 of 327 total issues

Function TaskTodosEditor has 136 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jobsworth.tasks.TaskTodosEditor = (function ($) {
  function TaskTodosEditor(options) {
    this.options = options;
    this.el = this.options.el;
    this.initialize();
Severity: Major
Found in app/assets/javascripts/tasks/task_todos_editor.js - About 5 hrs to fix

    Function TaskDetailsEditor has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    jobsworth.tasks.TaskDetailsEditor = (function ($) {
      function TaskDetailsEditor(options) {
        this.options = options;
        this.taskId = this.options.taskId;
        this.el = this.options.el;
    Severity: Major
    Found in app/assets/javascripts/tasks/task_details_editor.js - About 5 hrs to fix

      Function TaskEditor has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

      jobsworth.tasks.TaskEditor = (function ($) {
        function TaskEditor(options) {
          this.options = options;
          this.taskId = this.options.taskId;
          this.el = this.options.el;
      Severity: Minor
      Found in app/assets/javascripts/tasks/task_editor.js - About 4 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

      Class TasksController has 37 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class TasksController < ApplicationController
        DEFAULT_TASK_COUNT = 5
        DEFAULT_TASK_NAME = 'New Task'
      
        before_filter :check_if_user_has_projects, :only => [:new, :create]
      Severity: Minor
      Found in app/controllers/tasks_controller.rb - About 4 hrs to fix

        Method do_column has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

          def do_column(w, key)
            @column_totals[key] += w.duration unless ['comment', '1_start', '2_end', '3_task', '4_note'].include?(key)
        
            rkey = key_from_worklog(w, 15).to_s
            row_name = name_from_worklog(w, 1)
        Severity: Minor
        Found in app/models/worklog_report.rb - About 4 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 key_from_worklog has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

          def key_from_worklog(w, r)
            if r == 1
              "#{w.customer.name} #{w.project.name} #{w.task.name} #{w.task.task_num}"
            elsif r == 2
              w.is_a?(Tag) ? w.id : 0
        Severity: Minor
        Found in app/models/worklog_report.rb - About 4 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 name_from_worklog has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

          def name_from_worklog(w, r)
            if r == 1
              "#{w.task.issue_num} <a href=\"/tasks/view/#{w.task.task_num}\">#{ERB::Util.h w.task.name}</a> <br /><small>#{ERB::Util.h w.task.full_name}</small>".html_safe
            elsif r == 2
              w.is_a?(Tag) ? "#{w.name}" : I18n.t('worklog_reports.status.none')
        Severity: Minor
        Found in app/models/worklog_report.rb - About 4 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

        Class TaskFilter has 34 methods (exceeds 20 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 4 hrs to fix

          Function TaskTimer has 107 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          jobsworth.tasks.TaskTimer = (function () {
          
            function bind() {
              var $ = jQuery;
              var self = this;
          Severity: Major
          Found in app/assets/javascripts/tasks/timer.js - About 4 hrs to fix

            Method get_action has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

              def get_action(log)
                if log.task && log.task_id > 0
                  action = 'Completed' if log.event_log.event_type == EventLog::TASK_COMPLETED
                  action = 'Reverted' if log.event_log.event_type == EventLog::TASK_REVERTED
                  action = 'Created' if log.event_log.event_type == EventLog::TASK_CREATED
            Severity: Minor
            Found in app/controllers/feeds_controller.rb - About 4 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 bindEvents has 104 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              TaskTodosEditor.prototype.bindEvents = function () {
                var self = this;
            
                $(this.el).on('click', ".toggle-todo-edit", function () {
                  self.toggleTodoEdit(this);
            Severity: Major
            Found in app/assets/javascripts/tasks/task_todos_editor.js - About 4 hrs to fix

              Function ColumnPicker has 97 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              jobsworth.grids.ColumnPicker = (function ($) {
                function ColumnPicker(columns, grid, options) {
                  var $menu;
                  var columnCheckboxes;
                  var columnList;
              Severity: Major
              Found in app/assets/javascripts/grids/columnpicker.js - About 3 hrs to fix

                Function ServiceEditor has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                jobsworth.services.ServiceEditor = (function ($) {
                  function ServiceEditor(options) {
                    this.options = options;
                    this.bindEvents();
                  }
                Severity: Major
                Found in app/assets/javascripts/services.js - About 3 hrs to fix

                  Function ColumnPicker has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function ColumnPicker(columns, grid, options) {
                      var $menu;
                      var columnCheckboxes;
                      var columnList;
                      var gear_icon = '<i title="Select Columns" class="icon-cog pull-right"></i>';
                  Severity: Major
                  Found in app/assets/javascripts/grids/columnpicker.js - About 3 hrs to fix

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