Vizzuality/gfw-climate

View on GitHub
app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js

Summary

Maintainability
F
2 wks
Test Coverage

File HistoricalTrendChartView.js has 818 lines of code (exceeds 250 allowed). Consider refactoring.
Open

define(
  [
    'backbone',
    'handlebars',
    'underscore',

    Function _drawFooterLabels has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          _drawFooterLabels: function() {
            var rowOffset = this.defaults.rowHeight;
            var yearLabel = _.findWhere(this.defaults.labels, { slug: 'year' });
            var yearLabelWidth = yearLabel.width * this.cWidthGrid / 100;
            var content = this.svg

      Function _drawGrid has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            _drawGrid: function() {
              // X Lines
              var numLines = this.chartData.length;
              var rowOffset = this.defaults.rowHeight;
              var linesGroup = this.svg

        Function _drawDeviation has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              _drawDeviation: function() {
                var total = _.reduce(
                  this.referenceData.values,
                  function(memo, data) {
                    return memo + data.value;

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

                _drawFooterDeviation: function() {
                  var rowOffset = this.defaults.rowHeight;
                  var deviationGroup = this.svg.select('.deviation');
                  var deviationLabel = _.findWhere(this.defaults.labels, {
                    slug: 'deviation'

            Function _drawGridFooter has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  _drawGridFooter: function() {
                    var rowOffset = this.defaults.rowHeight * 2.5;
            
                    var grid = this.svg
                      .append('g')

              Function _drawLoss has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    _drawLoss: function() {
                      var lossGroup = this.svg.select('.loss');
                      var lossLabel = _.findWhere(this.defaults.labels, { slug: 'loss' });
                      var lossLabelWidth = lossLabel.width * this.cWidthGrid / 100;
                      var lossContent = this.svg

                Function _drawFooterAverages has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      _drawFooterAverages: function() {
                        var rowOffset = this.defaults.rowHeight;
                        var averageGroup = this.svg.select('.loss');
                        var averageLabel = _.findWhere(this.defaults.labels, { slug: 'loss' });
                        var averageLabelWidth = averageLabel.width * this.cWidthGrid / 100;

                  Function _drawBars has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        _drawBars: function() {
                          var averageGroup = this.svg.select('.average');
                          var leftOffset =
                            d3.transform(averageGroup.attr('transform')).translate[0] +
                            this.defaults.barMargin;

                    Function _drawYears has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          _drawYears: function() {
                            var yearGroup = this.svg.select('.year');
                            var yearLabel = _.findWhere(this.defaults.labels, { slug: 'year' });
                            var yearLabelWidth = yearLabel.width * this.cWidthGrid / 100;
                            var yearsContent = this.svg

                      Function _drawFooterBars has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            _drawFooterBars: function() {
                              var rowOffset = this.defaults.rowHeight;
                              var averageGroup = this.svg.select('.average');
                              var leftOffset =
                                d3.transform(averageGroup.attr('transform')).translate[0] +

                        Function _parseData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              _parseData: function() {
                                this.chartData = [];
                        
                                for (var indicator in this.data) {
                                  var current = this.data[indicator];

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

                                _setAxisScale: function() {
                                  var average = _.findWhere(this.defaults.labels, { slug: 'average' });
                                  var barsContentWidth =
                                    average.width * this.cWidthGrid / 100 - this.defaults.barMargin * 2;
                          
                          
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 174..203

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

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

                                        if (this.defaults.customLabel && label.slug === 'loss') {
                                          var customLabel = group
                                            .append('text')
                                            .attr('class', 'label')
                                            .attr('y', this.defaults.rowHeight / 2)
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 295..310

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

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

                                _setCustomLabel: function(label, group) {
                                  if (label.search(this.defaults.underscript) !== -1) {
                                    var unit = label.split(this.defaults.underscript);
                                    for (var x = 0; x < unit.length; x++) {
                                      group.append('tspan').text(unit[x]);
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 326..341

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

                          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

                                remove: function(params) {
                                  if (this.svg) {
                                    var svgContainer = this.chartEl.querySelector('svg');
                          
                                    if (params && !params.keepEvents) {
                          app/assets/javascripts/countries/views/report/PieChartView.js on lines 219..231
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 585..597
                          app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 497..509

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

                          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

                                _drawGraph: function() {
                                  this._drawYears();
                                  this._drawLoss();
                                  this._drawDeviation();
                                  this._drawBars();
                          app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 482..492

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

                          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

                                  contentGroup
                                    .append('text')
                                    .attr('class', 'value')
                                    .text(function(d) {
                                      return NumbersHelper.addNumberDecimals(
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 464..483

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

                          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

                                  lossGroup
                                    .append('text')
                                    .attr('class', 'value')
                                    .text(function(d) {
                                      return NumbersHelper.addNumberDecimals(
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 829..845

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

                          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 deviationContent = this.svg
                                    .append('g')
                                    .attr(
                                      'transform',
                                      'translate(' +
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 805..815

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

                          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 averageContent = this.svg
                                    .append('g')
                                    .attr(
                                      'transform',
                                      'translate(' +
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 863..873

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

                          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 contentGroup = averageContent
                                    .selectAll('g')
                                    .data(this.averageData)
                                    .enter()
                                    .append('g')
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 356..366
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 521..531

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

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

                                  var svg = d3
                                    .select(el)
                                    .append('svg')
                                    .attr('width', this.cWidth + margin.left + margin.right + 'px')
                                    .attr('height', this.cHeight + margin.top + margin.bottom + 'px');
                          app/assets/javascripts/countries/views/report/PieChartView.js on lines 149..153
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 157..161
                          app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 241..245
                          app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 283..287

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

                          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 yearsGroup = yearsContent
                                    .selectAll('g')
                                    .data(this.chartData)
                                    .enter()
                                    .append('g')
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 563..573

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

                          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 barGroup = barsContent
                                    .selectAll('g')
                                    .data(this.chartData)
                                    .enter()
                                    .append('g')
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 405..415

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

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

                                _setDomain: function() {
                                  this.x.domain(this.domain.x);
                                  this.x2.domain(this.domain.x2);
                                  this.y.domain(this.domain.y);
                                },
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 208..212

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

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

                                initialize: function(settings) {
                                  this.defaults = _.extend({}, this.defaults, settings);
                                  this.data = this.defaults.data;
                          
                                  this._initChart();
                          app/assets/javascripts/countries/views/report/PieChartView.js on lines 42..50
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 65..73

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

                                  var yearsContent = this.svg
                                    .append('g')
                                    .attr(
                                      'transform',
                                      'translate(' +
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 441..450
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 345..354
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 387..396
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 459..468

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

                          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

                                  var lossContent = this.svg
                                    .append('g')
                                    .attr(
                                      'transform',
                                      'translate(' +
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 394..403
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 345..354
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 387..396
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 459..468

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

                          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

                                setListeners: function() {
                                  this.refreshEvent = _.debounce(_.bind(this._update, this), 30);
                                  window.addEventListener('resize', this.refreshEvent, false);
                                },
                          app/assets/javascripts/countries/views/report/PieChartView.js on lines 92..95
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 116..119
                          app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 168..171

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

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

                                  content
                                    .append('text')
                                    .attr('class', 'label')
                                    .attr(
                                      'dx',
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 676..685
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 710..724
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 727..745

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

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

                                  content
                                    .append('text')
                                    .attr('class', 'label subtitle')
                                    .attr(
                                      'dx',
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 688..702
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 710..724
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 727..745

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

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

                                  content
                                    .append('text')
                                    .attr('class', 'label')
                                    .attr(
                                      'dx',
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 676..685
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 688..702
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 710..724

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

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

                                render: function() {
                                  this._setUpGraph();
                                  this._drawGrid();
                                  this._setAxisScale();
                                  this._setDomain();
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 105..111
                          app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 157..163
                          app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 224..230

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

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

                                  content
                                    .append('text')
                                    .attr('class', 'label subtitle')
                                    .attr(
                                      'dx',
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 676..685
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 688..702
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 727..745

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

                          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

                                    linesGroup
                                      .append('rect')
                                      .attr('class', 'xAxis')
                                      .attr('width', this.cWidth)
                                      .attr('height', 1)
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 643..649

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

                          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

                                  grid
                                    .append('rect')
                                    .attr('class', 'xAxis')
                                    .attr('width', this.cWidth)
                                    .attr('height', 1)
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 305..311

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

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

                                  barGroup
                                    .append('rect')
                                    .attr('class', function(d) {
                                      return 'bar ' + d.type;
                                    })
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 575..590

                          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

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

                                _start: function() {
                                  this.$el.html(
                                    this.template({
                                      hasData: this.chartData.length
                                    })
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 87..95

                          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

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

                                  barGroup
                                    .append('rect')
                                    .attr('class', function(d) {
                                      return 'bar ' + d.type;
                                    })
                          app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 782..793

                          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

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

                                  this.svg = svg
                                    .append('g')
                                    .attr(
                                      'transform',
                                      'translate(' + margin.left + ',' + margin.top + ')'
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 163..168
                          app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 247..252
                          app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 313..318

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

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

                                  var barsContent = this.svg
                                    .append('g')
                                    .attr(
                                      'transform',
                                      'translate(' + leftOffset + ', ' + this.defaults.rowHeight + ')'
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 514..519

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

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

                                      var group = this.svg
                                        .append('g')
                                        .attr('transform', 'translate(' + marginOffset + ', 0)')
                                        .attr('class', label.slug);
                          app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 282..285

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

                          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