robertgauld/OSMExtender

View on GitHub
app/assets/javascripts/statistics/email_reminders.js

Summary

Maintainability
D
3 days
Test Coverage

Function drawCharts has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function drawCharts() {
  $.ajax({
    url: 'email_reminders.json',
    dataType:"json",
    async: false,
Severity: Major
Found in app/assets/javascripts/statistics/email_reminders.js - About 2 hrs to fix

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

        success: function(data, status, jqXHR) {
          var number_desired_steps = 5;
          var day_desired_steps = 5;
          var item_desired_steps = 5;
    
    
    Severity: Minor
    Found in app/assets/javascripts/statistics/email_reminders.js - About 1 hr to fix

      Function drawDayChart has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function drawDayChart(data, options, chart) {
        data_table = new google.visualization.DataTable();
        data_table.addColumn({
          type: 'string',
          label: 'Day'
      Severity: Minor
      Found in app/assets/javascripts/statistics/email_reminders.js - About 1 hr to fix

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

        function drawItemChart(data, options, chart) {
          data_table = new google.visualization.DataTable();
          data_table.addColumn({
            type: 'string',
            label: 'Item'
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 1 other location - About 4 hrs to fix
        app/assets/javascripts/statistics/automation_tasks.js on lines 38..54

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

        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 item_options = {
                focusTarget: 'category',
                hAxis: {
                  minValue: 0,
                  gridlines: {
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 2 other locations - About 1 hr to fix
        app/assets/javascripts/statistics/automation_tasks.js on lines 19..29
        app/assets/javascripts/statistics/email_reminders.js on lines 21..31

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

        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 number_options = {
                focusTarget: 'category',
                vAxis: {
                  minValue: 0,
                  gridlines: {
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 2 other locations - About 1 hr to fix
        app/assets/javascripts/statistics/automation_tasks.js on lines 19..29
        app/assets/javascripts/statistics/email_reminders.js on lines 51..61

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

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

          data_table.addRow([ 'Sat', data[0][6], data[1][6]['subscribed'], data[1][6]['unsubscribed'], data[1][6]['pending'] ]);
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 6 other locations - About 1 hr to fix
        app/assets/javascripts/statistics/email_reminders.js on lines 116..116
        app/assets/javascripts/statistics/email_reminders.js on lines 117..117
        app/assets/javascripts/statistics/email_reminders.js on lines 118..118
        app/assets/javascripts/statistics/email_reminders.js on lines 119..119
        app/assets/javascripts/statistics/email_reminders.js on lines 120..120
        app/assets/javascripts/statistics/email_reminders.js on lines 122..122

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

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

          data_table.addRow([ 'Thu', data[0][4], data[1][4]['subscribed'], data[1][4]['unsubscribed'], data[1][4]['pending'] ]);
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 6 other locations - About 1 hr to fix
        app/assets/javascripts/statistics/email_reminders.js on lines 116..116
        app/assets/javascripts/statistics/email_reminders.js on lines 117..117
        app/assets/javascripts/statistics/email_reminders.js on lines 118..118
        app/assets/javascripts/statistics/email_reminders.js on lines 120..120
        app/assets/javascripts/statistics/email_reminders.js on lines 121..121
        app/assets/javascripts/statistics/email_reminders.js on lines 122..122

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

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

          data_table.addRow([ 'Wed', data[0][3], data[1][3]['subscribed'], data[1][3]['unsubscribed'], data[1][3]['pending'] ]);
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 6 other locations - About 1 hr to fix
        app/assets/javascripts/statistics/email_reminders.js on lines 116..116
        app/assets/javascripts/statistics/email_reminders.js on lines 117..117
        app/assets/javascripts/statistics/email_reminders.js on lines 119..119
        app/assets/javascripts/statistics/email_reminders.js on lines 120..120
        app/assets/javascripts/statistics/email_reminders.js on lines 121..121
        app/assets/javascripts/statistics/email_reminders.js on lines 122..122

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

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

          data_table.addRow([ 'Fri', data[0][5], data[1][5]['subscribed'], data[1][5]['unsubscribed'], data[1][5]['pending'] ]);
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 6 other locations - About 1 hr to fix
        app/assets/javascripts/statistics/email_reminders.js on lines 116..116
        app/assets/javascripts/statistics/email_reminders.js on lines 117..117
        app/assets/javascripts/statistics/email_reminders.js on lines 118..118
        app/assets/javascripts/statistics/email_reminders.js on lines 119..119
        app/assets/javascripts/statistics/email_reminders.js on lines 121..121
        app/assets/javascripts/statistics/email_reminders.js on lines 122..122

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

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

          data_table.addRow([ 'Mon', data[0][1], data[1][1]['subscribed'], data[1][1]['unsubscribed'], data[1][1]['pending'] ]);
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 6 other locations - About 1 hr to fix
        app/assets/javascripts/statistics/email_reminders.js on lines 117..117
        app/assets/javascripts/statistics/email_reminders.js on lines 118..118
        app/assets/javascripts/statistics/email_reminders.js on lines 119..119
        app/assets/javascripts/statistics/email_reminders.js on lines 120..120
        app/assets/javascripts/statistics/email_reminders.js on lines 121..121
        app/assets/javascripts/statistics/email_reminders.js on lines 122..122

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

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

          data_table.addRow([ 'Tue', data[0][2], data[1][2]['subscribed'], data[1][2]['unsubscribed'], data[1][2]['pending'] ]);
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 6 other locations - About 1 hr to fix
        app/assets/javascripts/statistics/email_reminders.js on lines 116..116
        app/assets/javascripts/statistics/email_reminders.js on lines 118..118
        app/assets/javascripts/statistics/email_reminders.js on lines 119..119
        app/assets/javascripts/statistics/email_reminders.js on lines 120..120
        app/assets/javascripts/statistics/email_reminders.js on lines 121..121
        app/assets/javascripts/statistics/email_reminders.js on lines 122..122

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

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

          data_table.addRow([ 'Sun', data[0][0], data[1][0]['subscribed'], data[1][0]['unsubscribed'], data[1][0]['pending'] ]);
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 6 other locations - About 1 hr to fix
        app/assets/javascripts/statistics/email_reminders.js on lines 116..116
        app/assets/javascripts/statistics/email_reminders.js on lines 117..117
        app/assets/javascripts/statistics/email_reminders.js on lines 118..118
        app/assets/javascripts/statistics/email_reminders.js on lines 119..119
        app/assets/javascripts/statistics/email_reminders.js on lines 120..120
        app/assets/javascripts/statistics/email_reminders.js on lines 121..121

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

        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

          for(data_row in data) {
            row = data[data_row];
            row[0] = new Date(row[0]);
            data_table.addRow(row);
          }
        Severity: Minor
        Found in app/assets/javascripts/statistics/email_reminders.js and 1 other location - About 45 mins to fix
        app/assets/javascripts/statistics/users.js on lines 49..53

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

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

              number_options.vAxis.maxValue = graphStepSize(data['number']['max_value'], number_desired_steps) * (number_options.vAxis.gridlines.count - 1);
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 4 other locations - About 40 mins to fix
        app/assets/javascripts/statistics/automation_tasks.js on lines 30..30
        app/assets/javascripts/statistics/email_reminders.js on lines 49..49
        app/assets/javascripts/statistics/email_reminders.js on lines 62..62
        app/assets/javascripts/statistics/sections.js on lines 71..71

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

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

              day_options.hAxis.maxValue = graphStepSize(data['day']['max_value'], day_desired_steps) * (day_options.hAxis.gridlines.count - 1);
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 4 other locations - About 40 mins to fix
        app/assets/javascripts/statistics/automation_tasks.js on lines 30..30
        app/assets/javascripts/statistics/email_reminders.js on lines 32..32
        app/assets/javascripts/statistics/email_reminders.js on lines 62..62
        app/assets/javascripts/statistics/sections.js on lines 71..71

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

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

              item_options.hAxis.maxValue = graphStepSize(data['item']['max_value'], item_desired_steps) * (item_options.hAxis.gridlines.count - 1);
        Severity: Major
        Found in app/assets/javascripts/statistics/email_reminders.js and 4 other locations - About 40 mins to fix
        app/assets/javascripts/statistics/automation_tasks.js on lines 30..30
        app/assets/javascripts/statistics/email_reminders.js on lines 32..32
        app/assets/javascripts/statistics/email_reminders.js on lines 49..49
        app/assets/javascripts/statistics/sections.js on lines 71..71

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

        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

        There are no issues that match your filters.

        Category
        Status