nacyot/putne

View on GitHub

Showing 66 of 66 total issues

Function d3_sunburst_chart has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

this.d3_sunburst_chart = function(selector, data_file = "/d3js/flare.json") {
    var target = d3.select(selector);
    var width = target[0][0].parentNode.clientWidth - 40 ;
    var height = width + 40;
    var radius = (Math.min(width, height) - 50) / 2;
Severity: Major
Found in app/assets/javascripts/graph/sunburst_chart.js - About 4 hrs to fix

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

                   var svg = target.append("svg")
                       .attr("width", width + margin.left + margin.right)
                       .attr("height", height + margin.top + margin.bottom)
                       .append("g")
                       .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
    Severity: Major
    Found in app/assets/javascripts/graph/day_hour_heatmap.js and 3 other locations - About 3 hrs to fix
    app/assets/javascripts/graph/line_chart.js on lines 31..35
    app/assets/javascripts/graph/multi_line_chart.js on lines 34..38
    app/assets/javascripts/graph/stacked_area_chart.js on lines 39..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 106.

    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

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

        var svg = target.append("svg")
            .attr("width", width + margin.left + margin.right)
            .attr("height", height + margin.top + margin.bottom)
            .append("g")
            .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
    Severity: Major
    Found in app/assets/javascripts/graph/line_chart.js and 3 other locations - About 3 hrs to fix
    app/assets/javascripts/graph/day_hour_heatmap.js on lines 31..35
    app/assets/javascripts/graph/multi_line_chart.js on lines 34..38
    app/assets/javascripts/graph/stacked_area_chart.js on lines 39..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 106.

    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

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

        var svg = target.append("svg")
            .attr("width", width + margin.left + margin.right)
            .attr("height", height + margin.top + margin.bottom)
            .append("g")
            .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
    Severity: Major
    Found in app/assets/javascripts/graph/stacked_area_chart.js and 3 other locations - About 3 hrs to fix
    app/assets/javascripts/graph/day_hour_heatmap.js on lines 31..35
    app/assets/javascripts/graph/line_chart.js on lines 31..35
    app/assets/javascripts/graph/multi_line_chart.js on lines 34..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 106.

    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

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

        var svg = target.append("svg")
            .attr("width", width + margin.left + margin.right)
            .attr("height", height + margin.top + margin.bottom)
            .append("g")
            .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
    Severity: Major
    Found in app/assets/javascripts/graph/multi_line_chart.js and 3 other locations - About 3 hrs to fix
    app/assets/javascripts/graph/day_hour_heatmap.js on lines 31..35
    app/assets/javascripts/graph/line_chart.js on lines 31..35
    app/assets/javascripts/graph/stacked_area_chart.js on lines 39..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 106.

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

    this.d3_multi_line_chart = function(selector, data_file = "/d3js/line_graph_multi.tsv"){
        var target = d3.select(selector);
        var parentWidth = target[0][0].parentNode.clientWidth;
    
        var margin = {top: 20, right: 120, bottom: 50, left: 50};
    Severity: Major
    Found in app/assets/javascripts/graph/multi_line_chart.js - About 2 hrs to fix

      Function d3_calendar_chart has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      this.d3_calendar_chart = function(selector, data_file = "/d3js/dji.csv"){
          var target = d3.select(selector);
          var parentWidth = target[0][0].parentNode.clientWidth;
      
          var width = parentWidth;
      Severity: Major
      Found in app/assets/javascripts/graph/calender.js - About 2 hrs to fix

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

            svg.selectAll(".month")
                .data(function(d) { return d3.time.months(new Date(d, 0, 1), new Date(d + 1, 0, 1)); })
                .enter().append("path")
                .attr("class", "month")
                .attr("d", monthPath);
        Severity: Major
        Found in app/assets/javascripts/graph/calender.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/graph/calender.js on lines 34..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 88.

        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

            var rect = svg.selectAll(".day")
                .data(function(d) { return d3.time.days(new Date(d, 0, 1), new Date(d + 1, 0, 1)); })
                .enter().append("rect")
                .attr("class", "day")
                .attr("width", cellSize)
        Severity: Major
        Found in app/assets/javascripts/graph/calender.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/graph/calender.js on lines 47..51

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

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

        this.d3_stacked_area_chart = function(selector, data_file){
            var target = d3.select(selector);
            var parentWidth = target[0][0].parentNode.clientWidth;
        
            var margin = {top: 20, right: 20, bottom: 30, left: 50};
        Severity: Major
        Found in app/assets/javascripts/graph/stacked_area_chart.js - About 2 hrs to fix

          File register_report.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module RegisterReport
            extend ActiveSupport::Concern
          
            def get_metrics
              Dir.chdir Rails.root
          Severity: Minor
          Found in app/models/concerns/register_report.rb - About 2 hrs to fix

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

                    svg.append("g")
                        .attr("class", "y axis")
                        .call(yAxis)
                        .append("text")
                        .attr("transform", "rotate(-90)")
            Severity: Major
            Found in app/assets/javascripts/graph/line_chart.js and 2 other locations - About 2 hrs to fix
            app/assets/javascripts/graph/bar_chart.js on lines 43..51
            app/assets/javascripts/graph/multi_line_chart.js on lines 68..76

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

            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 3 locations. Consider refactoring.
            Open

                    svg.append("g")
                        .attr("class", "y axis")
                        .call(yAxis)
                        .append("text")
                        .attr("transform", "rotate(-90)")
            Severity: Major
            Found in app/assets/javascripts/graph/bar_chart.js and 2 other locations - About 2 hrs to fix
            app/assets/javascripts/graph/line_chart.js on lines 51..59
            app/assets/javascripts/graph/multi_line_chart.js on lines 68..76

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

            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 3 locations. Consider refactoring.
            Open

                    svg.append("g")
                        .attr("class", "y axis")
                        .call(yAxis)
                        .append("text")
                        .attr("transform", "rotate(-90)")
            Severity: Major
            Found in app/assets/javascripts/graph/multi_line_chart.js and 2 other locations - About 2 hrs to fix
            app/assets/javascripts/graph/bar_chart.js on lines 43..51
            app/assets/javascripts/graph/line_chart.js on lines 51..59

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

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

            this.d3_bar_chart = function(selector, data_file = "/d3js/bar_graph.tsv"){
                var target = d3.select(selector);
                var parentWidth = target[0][0].parentNode.clientWidth;
            
                var margin = {top: 20, right: 20, bottom: 30, left: 40};
            Severity: Major
            Found in app/assets/javascripts/graph/bar_chart.js - About 2 hrs to fix

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

              this.d3_line_chart = function(selector = "#line-graph", data_file = "/d3js/line_graph.tsv"){
                  var target = d3.select(selector);
                  var parentWidth = target[0][0].parentNode.clientWidth;
              
                  var margin = {top: 20, right: 80, bottom: 30, left: 50};
              Severity: Minor
              Found in app/assets/javascripts/graph/line_chart.js - About 1 hr to fix

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

                    var svg = target.append("svg")
                        .attr("width", width)
                        .attr("height", height)
                        .append("g")
                        .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
                Severity: Major
                Found in app/assets/javascripts/graph/pie_chart.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/graph/donut_chart.js on lines 22..26
                app/assets/javascripts/graph/sunburst_chart.js on lines 19..23

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

                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 3 locations. Consider refactoring.
                Open

                    var svg = target.append("svg")
                        .attr("width", width)
                        .attr("height", height)
                        .append("g")
                        .attr("transform", "translate(" + width / 2 + "," + height * .52 + ")");
                Severity: Major
                Found in app/assets/javascripts/graph/sunburst_chart.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/graph/donut_chart.js on lines 22..26
                app/assets/javascripts/graph/pie_chart.js on lines 26..30

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

                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 3 locations. Consider refactoring.
                Open

                    var svg = target.append("svg")
                        .attr("width", width)
                        .attr("height", height)
                        .append("g")
                        .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
                Severity: Major
                Found in app/assets/javascripts/graph/donut_chart.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/graph/pie_chart.js on lines 26..30
                app/assets/javascripts/graph/sunburst_chart.js on lines 19..23

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

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

                  def register_flogs
                    report = MetricFuReport::FlogParser.new report_directory
                
                    score_category = ScoreCategory.find_or_create_by name: "COMPLEXITY"
                    score_source = ScoreSource.find_or_create_by name: "FLOG"
                Severity: Minor
                Found in app/models/concerns/register_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