ari/jobsworth

View on GitHub

Showing 327 of 327 total issues

Method ical has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
Open

  def ical(mode = :personal)
    if params[:id].nil? || params[:id].empty?
      render :nothing => true
      return
    end
Severity: Minor
Found in app/controllers/feeds_controller.rb - About 1 day 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 TaskEditor has 296 lines of code (exceeds 25 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: Major
Found in app/assets/javascripts/tasks/task_editor.js - About 1 day to fix

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

      CustomAttributeEdit.prototype.presetChange = function (checkbox) {
        checkbox = $(checkbox);
        var preset = checkbox.is(":checked");
    
        var parent = checkbox.parents(".attribute");
    Severity: Major
    Found in app/assets/javascripts/custom_attribute_edit.js and 1 other location - About 1 day to fix
    app/assets/javascripts/task_property_edit.js on lines 53..75

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

    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

      TaskPropertyEdit.prototype.presetChange = function (checkbox) {
        checkbox = $(checkbox);
        var preset = checkbox.is(":checked");
    
        var parent = checkbox.parents(".attribute");
    Severity: Major
    Found in app/assets/javascripts/task_property_edit.js and 1 other location - About 1 day to fix
    app/assets/javascripts/custom_attribute_edit.js on lines 23..45

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

    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 get_tz_name has a Cognitive Complexity of 68 (exceeds 5 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: Minor
    Found in app/assets/javascripts/tz.js - About 1 day 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 Grid has 258 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    jobsworth.Grid = (function ($) {
    
      var columns = [
        {
          id: 'read',
    Severity: Major
    Found in app/assets/javascripts/grid.js - About 1 day to fix

      File abstract_task.rb has 551 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'active_record_extensions'
      # this is abstract class for Task and Template
      class AbstractTask < ActiveRecord::Base
        self.table_name = 'tasks'
      
      
      Severity: Major
      Found in app/models/abstract_task.rb - About 1 day to fix

        Function Grid has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
        Open

        jobsworth.Grid = (function ($) {
        
          var columns = [
            {
              id: 'read',
        Severity: Minor
        Found in app/assets/javascripts/grid.js - About 1 day 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 rss has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
        Open

          def rss
            return if params[:id].blank?
        
            headers['Content-Type'] = 'application/rss+xml'
        
        
        Severity: Minor
        Found in app/controllers/feeds_controller.rb - About 1 day 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 has a Cognitive Complexity of 54 (exceeds 5 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: Minor
        Found in app/models/abstract_task.rb - About 1 day 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 AbstractTask has 55 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class AbstractTask < ActiveRecord::Base
          self.table_name = 'tasks'
        
          OPEN=0
          CLOSED=1
        Severity: Major
        Found in app/models/abstract_task.rb - About 7 hrs to fix

          File worklog_report.rb has 468 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class WorklogReport
            include ERB::Util
          
            PIVOT = 1
            AUDIT = 2
          Severity: Minor
          Found in app/models/worklog_report.rb - About 7 hrs to fix

            Function Filter has 176 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            jobsworth.Filter = (function ($) {
              function Filter() {
                this.init();
                this.bind();
              }
            Severity: Major
            Found in app/assets/javascripts/filter.js - About 7 hrs to fix

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

              jQuery(document).ready(function () {
                jQuery("#task-filters-collapsable-sidepanel-button").on('click', function () {
                  if (store.get('task-filters-collapsable-sidepanel-button') == 'h') {
                    jQuery("#task-filters-collapsable-sidepanel-button").addClass('panel-open');
                    jQuery("#task-filters-collapsable-sidepanel-button").removeClass('panel-collapsed');
              Severity: Major
              Found in app/assets/javascripts/filter.js and 1 other location - About 7 hrs to fix
              app/assets/javascripts/filter.js on lines 234..249

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

              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

              jQuery(document).ready(function () {
                jQuery("#tags-collapsable-sidepanel-button").on('click', function () {
                  if (store.get('tags-collapsable-sidepanel-button') == 'h') {
                    jQuery("#tags-collapsable-sidepanel-button").addClass('panel-open');
                    jQuery("#tags-collapsable-sidepanel-button").removeClass('panel-collapsed');
              Severity: Major
              Found in app/assets/javascripts/filter.js and 1 other location - About 7 hrs to fix
              app/assets/javascripts/filter.js on lines 251..266

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

              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

              Method render_task_dependants has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
              Open

                def render_task_dependants(t, depth, root_present)
                  res = ''
                  @printed_ids ||= []
              
                  return if @printed_ids.include? t.id
              Severity: Minor
              Found in app/helpers/tasks_helper.rb - About 6 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_controller.rb has 443 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'csv'
              
              class TasksController < ApplicationController
                DEFAULT_TASK_COUNT = 5
                DEFAULT_TASK_NAME = 'New Task'
              Severity: Minor
              Found in app/controllers/tasks_controller.rb - About 6 hrs to fix

                Function Portal has 152 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                jobsworth.Portal = (function () {
                  var $ = jQuery;
                
                  function Portal(options) {
                    this.options = options;
                Severity: Major
                Found in app/assets/javascripts/widget.js - About 6 hrs to fix

                  Function TaskNotificationEditor has 149 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Method create_csv has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def create_csv
                        csv_string = ''
                        if @column_headers
                          CSV.generate(csv_string, :col_sep => ',') do |csv|
                    
                    
                    Severity: Minor
                    Found in app/models/worklog_report.rb - About 5 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