ari/jobsworth

View on GitHub

Showing 327 of 327 total issues

Function Portal has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

jobsworth.Portal = (function () {
  var $ = jQuery;

  function Portal(options) {
    this.options = options;
Severity: Minor
Found in app/assets/javascripts/widget.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 burnup_extracted_from_show has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

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

Method schedule_extracted_from_show has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def schedule_extracted_from_show
    filter = filter_from_filter_by

    if @widget.mine?
      tasks = current_user.tasks.eager_load(:users, :tags, :sheets, :todos, :dependencies, :dependants, {:project => :customer}, :milestone).where("tasks.completed_at IS NULL AND projects.completed_at IS NULL #{filter} AND (tasks.due_at IS NOT NULL OR tasks.milestone_id IS NOT NULL)")
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

Method init_rows_and_columns has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def init_rows_and_columns
    @total = 0
    @row_totals = {}
    @column_totals = {}
    @column_headers = {}
Severity: Major
Found in app/models/worklog_report.rb - About 2 hrs to fix

    Function NextTaskPanel has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    jobsworth.tasks.NextTaskPanel = (function ($) {
      function NextTaskPanel(options) {
        this.options = options;
        this.options["popover_placement"] = options["popover_placement"] || "left";
        this.el = options.el;
    Severity: Minor
    Found in app/assets/javascripts/tasks/next_task_panel.js - About 2 hrs to fix

      Function handleHeaderClick has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function handleHeaderClick(e, args) {
            var column = args.column;
            if (column.id != gear_column_id) {
              return;
            }
      Severity: Minor
      Found in app/assets/javascripts/grids/columnpicker.js - About 1 hr to fix

        Method do_column has 48 lines of code (exceeds 25 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 1 hr to fix

          Method search has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def search
              search_criteria = params[:term].strip
          
              @customers = []
              @users = []
          Severity: Minor
          Found in app/controllers/customers_controller.rb - About 1 hr 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 Task has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          jobsworth.Task = (function ($) {
            function Task(id) {
              this.load(id);
            }
          
          
          Severity: Minor
          Found in app/assets/javascripts/task.js - About 1 hr to fix

            Method key_from_worklog has 47 lines of code (exceeds 25 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 1 hr to fix

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

                Filter.prototype.bind = function () {
                  var self = this;
              
                  // the user/client search box
                  $(".search_filter").focus(function () {
              Severity: Minor
              Found in app/assets/javascripts/filter.js - About 1 hr to fix

                Method to_html has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def to_html
                    return '' if body.blank?
                
                    pres = []
                
                
                Severity: Minor
                Found in app/models/wiki_revision.rb - About 1 hr to fix

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

                          case 'snooze-till-tomorrow':
                            $('#snooze_until_date span').html(formatDate(tomorrow));
                            $('#task_hide_until').val(formatDate(tomorrow));
                            $('#snooze_until_date').show();
                            $('#show-till-other-task, #customer-reply-label').hide();
                  Severity: Major
                  Found in app/assets/javascripts/tasks/task_editor.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/tasks/task_editor.js on lines 321..326

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

                  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

                          else {
                            $("#content_" + response.dom_id).show();
                            $("#indicator-" + response.dom_id).removeClass("widget-collapsed");
                            $("#indicator-" + response.dom_id).addClass("widget-open");
                          }
                  Severity: Major
                  Found in app/assets/javascripts/widget.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/widget.js on lines 97..101

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

                  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

                          case 'snooze-till-next-week':
                            $('#snooze_until_date span').html(formatDate(next_mon));
                            $('#task_hide_until').val(formatDate(next_mon));
                            $('#snooze_until_date').show();
                            $('#show-till-other-task, #customer-reply-label').hide();
                  Severity: Major
                  Found in app/assets/javascripts/tasks/task_editor.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/tasks/task_editor.js on lines 315..320

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

                  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

                          if (response.collapsed) {
                            $("#content_" + response.dom_id).hide();
                            $("#indicator-" + response.dom_id).removeClass("widget-open");
                            $("#indicator-" + response.dom_id).addClass("widget-collapsed");
                          }
                  Severity: Major
                  Found in app/assets/javascripts/widget.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/widget.js on lines 102..106

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

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

                    def receive(email)
                      # create wrapper email object
                      wrapper = Mailman::Email.new(email)
                  
                      logger.tagged('EMAIL TRACKING') { logger.info 'receive wrapper' }
                  Severity: Minor
                  Found in app/models/mailman.rb - About 1 hr 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 range has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def range
                      return @range if @range
                  
                      # Swap to an appropriate range based on entries returned
                      start_date = self.start_date
                  Severity: Minor
                  Found in app/models/worklog_report.rb - About 1 hr 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 milestones_to_select_tag has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def milestones_to_select_tag(milestones)
                      options = [%Q[<option value="0" title="#{t('forms.select.please_select')}">#{t('forms.select.none')}</option>]] + milestones.collect do |milestone|
                        date = milestone.due_at.nil? ? t('shared.not_set') : l(milestone.due_at, format: current_user.date_format)
                  
                        selected = if (@task.milestone_id == milestone.id) || (@task.milestone_id.nil? && milestone.id == '0')
                  Severity: Minor
                  Found in app/helpers/tasks_helper.rb - About 1 hr 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 init_start_and_end_dates has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def init_start_and_end_dates(params)
                      range = params[:range].to_i
                      case range
                        when 0
                          # Today
                  Severity: Minor
                  Found in app/models/worklog_report.rb - About 1 hr 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