Showing 1,213 of 1,213 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
define(['backbone', 'jquery'], function(Backbone, $) {
var CountriesCollection = Backbone.Model.extend({
url: '/api/countries/',
parse: function(data) {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
case 'areas-interest':
widgets = widgets[forestAndCarbon];
areas = this.presenter.countryModel.get('areas_of_interest');
areas = areas.length > 0 ? areas : null;
break;
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
render: function() {
this._setUpGraph();
this._drawGrid();
this._setAxisScale();
this._setDomain();
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
case 'subnational':
widgets = widgets[forestAndCarbon];
jurisdictions = this.presenter.countryModel.get('jurisdictions');
jurisdictions = jurisdictions.length > 0 ? jurisdictions : null;
break;
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function renderIsoLayers
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderIsoLayers: function(layers) {
var country = _.find(
amplify.store('countries'),
_.bind(function(country) {
return country.iso === this.iso;
Function _player
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_player: function() {
if (this.$play_pause.hasClass('is-playing')) {
window.setTimeout(
function() {
this.progression += 100 / this.ticks;
Function formatXaxis
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
formatXaxis: function() {
var self = this;
d3
.select('.xaxis')
.selectAll('text')
Function _drawDashedLine
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_drawDashedLine: function() {
var _this = this;
var allYData = _.pluck(this.chartData, this.dataColumns.dashed.y);
var allXData = _.pluck(this.chartData, this.dataColumns.dashed.x);
Function _drawDots
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_drawDots: function() {
var _this = this;
var dotsGroup = this.svg
.append('g')
.attr('class', 'dots-group')
Function selectYear
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
selectYear: function(val) {
// LEFT
this.ext.left = this.xscale(val);
this.domain.attr('x2', this.ext.right);
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var $spinner = this.$el.find('#spinner2');
var τ = 2 * Math.PI;
var width = $spinner.width();
var height = $spinner.height();
Function PieChart
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PieChart = function(options) {
this.options = options;
this.data = this._defindeData(options.data);
enquire.register(
Function setListeners
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
LineChart.prototype.setListeners = function() {
var formatDate = d3.time.format('%Y');
var bisectDate = d3.bisector(function(d) {
return d.year;
}).left;
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var view = this.presenter.status.get('view');
var options = {
country: this.presenter.status.get('country'),
parent: this.$el.find('.reports-grid')
Function getCountryStats
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
getCountryStats: function(params) {
return new Promise(
function(resolve, reject) {
this.getClimateConfig()
.then(
Function _drawAxes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
StackedChart.prototype._drawAxes = function() {
var self = this;
var tickSizeX = $(window).width() > 1025 ? 1 : 2;
var tickFormatY = this.unit != 'percentage' ? '.2s' : '.2f';
this.xAxis = d3.svg
Function StackedChart
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var StackedChart = function(options) {
this.svg;
this.options = options;
this.parent = options.parent;
this.data = options.data;
Function _setAxisScale
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setAxisScale: function() {
var _this = this;
var xTickFormat = d3.time.format(_this.defaults.dateFormat);
var yTickFormat = function(d) {
return d > 999 ? d / 1000 + 'k' : d;
Function _drawAxes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
LineChart.prototype._drawAxes = function() {
var self = this;
var tickSizeX = $(window).width() > 1025 ? 1 : 2;
var tickFormatY = this.unit != 'percentage' ? '.2s' : '.2f';
this.xAxis = d3.svg
Function _player
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_player: function() {
if (this.$play_pause.hasClass('is-playing')) {
window.setTimeout(
function() {
this.progression += 100 / this.ticks;