ari/jobsworth

View on GitHub

Showing 267 of 327 total issues

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

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

                    Portal.prototype.bindEvents = function () {
                      var self = this;
                  
                      // sortable
                      $("#widget-container").find(".column").sortable({
                  Severity: Major
                  Found in app/assets/javascripts/widget.js - About 2 hrs to fix

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

                      TaskEditor.prototype.initialize = function () {
                        var detailContainer = $("#task_details", $(this.el))[0];
                        this.taskDetailsEditor = new jobsworth.tasks.TaskDetailsEditor({taskId: this.taskId, el: detailContainer});
                    
                        var notificationContainer = $("#task_notify", $(this.el))[0];
                    Severity: Major
                    Found in app/assets/javascripts/tasks/task_editor.js - About 2 hrs to fix

                      Function snooze_effects has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        TaskEditor.prototype.snooze_effects = function () {
                          function formatDate(d) {
                            return d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear();
                          }
                      
                      
                      Severity: Major
                      Found in app/assets/javascripts/tasks/task_editor.js - About 2 hrs to fix

                        Function bind has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Function bind has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            Grid.prototype.bind = function () {
                              var self = this;
                          
                              $("#groupBy select").change(function () {
                                var value = $(this).val();
                          Severity: Major
                          Found in app/assets/javascripts/grid.js - About 2 hrs to fix

                            Method search_conditions_for has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def self.search_conditions_for(strings, fields = [:name], options = {})
                                search_by_id = options.has_key?(:search_by_id) ? options[:search_by_id] : true
                                id_field= options.has_key?(:table) ? "#{options[:table]}.id" : 'id'
                            
                                conds = []
                            Severity: Minor
                            Found in app/models/search.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

                            Severity
                            Category
                            Status
                            Source
                            Language