denniskuczynski/beanstalkd_view

View on GitHub

Showing 7 of 7 total issues

Function add_job has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function add_job() {
      var tube = document.getElementById("form_tube_name").value;
      var priority = document.getElementById("form_job_priority").value;
      var delay = document.getElementById("form_job_delay").value;
      var ttr = document.getElementById("form_job_ttr").value;
Severity: Major
Found in web/js/peek_jobs.js - About 2 hrs to fix

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

        if ($('#total_jobs_chart').length > 0) {
          var total_jobs_data = $('#total_jobs_chart').data('set');
          if (total_jobs_data !== null) {
            draw_pie_chart('total_jobs_chart', total_jobs_data);
            $("#total_jobs_container").css('visibility', 'visible');
    Severity: Major
    Found in web/js/draw_chart.js and 1 other location - About 1 hr to fix
    web/js/draw_chart.js on lines 40..46

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

    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 ($('#buried_jobs_chart').length > 0) {
          var buried_jobs_data = $('#buried_jobs_chart').data('set');
          if (buried_jobs_data !== null) {
            draw_pie_chart('buried_jobs_chart', buried_jobs_data);
            $("#buried_jobs_container").css('visibility', 'visible');
    Severity: Major
    Found in web/js/draw_chart.js and 1 other location - About 1 hr to fix
    web/js/draw_chart.js on lines 32..38

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

    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 exports has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(grunt) {
    
      // Project configuration.
      grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
    Severity: Minor
    Found in Gruntfile.js - About 1 hr to fix

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

          if ($("#peek_delayed_btn").length > 0) {
            $("#peek_delayed_btn").click(function(event) {
              event.preventDefault();
              peek('delayed');
            });
      Severity: Major
      Found in web/js/peek_jobs.js and 1 other location - About 1 hr to fix
      web/js/peek_jobs.js on lines 17..22

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

      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 ($("#peek_buried_btn").length > 0) {
            $("#peek_buried_btn").click(function(event) {
              event.preventDefault();
              peek('buried');
            });
      Severity: Major
      Found in web/js/peek_jobs.js and 1 other location - About 1 hr to fix
      web/js/peek_jobs.js on lines 11..16

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

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

          def guess_min_peek_range(tubes)
            min = 0
            tubes.each do |tube|
              response = tube.peek('ready')
              if response
      Severity: Minor
      Found in lib/beanstalkd_view/beanstalkd_utils.rb - About 25 mins 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