ari/jobsworth

View on GitHub

Showing 327 of 327 total issues

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 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              select: function (event, ui) {
                var id = ui.item.id;
                $(this).val("");
                $.get("/tasks/resource/", {resource_id: id}, function (data) {
                  $("#task_resources").append(data);
        Severity: Major
        Found in app/assets/javascripts/tasks/task_editor.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/tasks/task_editor.js on lines 36..43

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 86.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              select: function (event, ui) {
                var id = ui.item.id;
                $(this).val("");
                $.get("/tasks/dependency/", {dependency_id: id}, function (data) {
                  $("#task_dependencies .dependencies").append(data);
        Severity: Major
        Found in app/assets/javascripts/tasks/task_editor.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/tasks/task_editor.js on lines 53..60

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 86.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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 update_group has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

              def update_group(user, group, value, icon = nil)
                if group == 'milestone'
                  val_arr = value.split('/')
                  task_project = user.projects.find_by(:name => val_arr[0])
                  if user.can?(task_project, 'milestone')
            Severity: Minor
            Found in app/models/task_record.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 ColumnPicker has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            jobsworth.grids.ColumnPicker = (function ($) {
              function ColumnPicker(columns, grid, options) {
                var $menu;
                var columnCheckboxes;
                var columnList;
            Severity: Minor
            Found in app/assets/javascripts/grids/columnpicker.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 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

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

              def billable
                @project = current_user.projects.find(params[:project_id]) if params[:project_id]
                return render :json => {:billable => false} if @project and @project.no_billing?
                return render :json => {:billable => false} if params[:service_id].to_i < 0
                return render :json => {:billable => true} if params[:service_id].to_i == 0
            Severity: Minor
            Found in app/controllers/tasks_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

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

              def do_row(rkey, rname, vkey, duration)
                unless @rows[rkey]
                  @rows[rkey] ||= {}
                  @row_totals[rkey] ||= 0
                  @rows[rkey]['__'] = rname
            Severity: Minor
            Found in app/models/worklog_report.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 Planning has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            jobsworth.tasks.Planning = (function ($) {
            
              function Planning() {
                this.init();
                this.bind();
            Severity: Major
            Found in app/assets/javascripts/tasks/planning.js - About 2 hrs to fix

              File feeds_controller.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'rss/maker'
              require 'icalendar'
              require 'google_chart'
              
              class FeedsController < ApplicationController
              Severity: Minor
              Found in app/controllers/feeds_controller.rb - About 2 hrs to fix

                Class Project has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Project < ActiveRecord::Base
                  # Creates a score_rules association and updates the score
                  # of all the task when adding a new score rule
                  include Scorable
                
                
                Severity: Minor
                Found in app/models/project.rb - About 2 hrs to fix

                  Class UsersController has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class UsersController < ApplicationController
                  
                    before_filter :protected_area, :except => [:update_seen_news, :avatar, :auto_complete_for_project_name, :auto_complete_for_user_name]
                  
                    def index
                  Severity: Minor
                  Found in app/controllers/users_controller.rb - About 2 hrs to fix

                    File grid.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    var jobsworth = jobsworth || {};
                    
                    jobsworth.Grid = (function ($) {
                    
                      var columns = [
                    Severity: Minor
                    Found in app/assets/javascripts/grid.js - About 2 hrs to fix

                      File mailman.rb has 259 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      class Mailman < ActionMailer::Base
                        # The marker in the email body that shows where the new content ends
                        BODY_SPLIT = 'o------ please reply above this line ------o'
                      
                        def self.receive(mail)
                      Severity: Minor
                      Found in app/models/mailman.rb - About 2 hrs to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          function TaskEditor(options) {
                            this.options = options;
                            this.taskId = this.options.taskId;
                            this.el = this.options.el;
                            this.initialize();
                        Severity: Major
                        Found in app/assets/javascripts/tasks/task_editor.js and 1 other location - About 2 hrs to fix
                        app/assets/javascripts/tasks/task_details_editor.js on lines 8..14

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 78.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          function TaskDetailsEditor(options) {
                            this.options = options;
                            this.taskId = this.options.taskId;
                            this.el = this.options.el;
                            this.initialize();
                        Severity: Major
                        Found in app/assets/javascripts/tasks/task_details_editor.js and 1 other location - About 2 hrs to fix
                        app/assets/javascripts/tasks/task_editor.js on lines 8..14

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 78.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language