Showing 540 of 540 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
const filtered = items.reduce((filtered, d) => {
// check for dates
const f = (utils.isDate(d[attr])) ? d[attr] : parseFloat(d[attr]);
- 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 97.
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
const filtered = items.reduce((filtered, d) => {
// check for dates
const f = (utils.isDate(d[attr])) ? d[attr] : parseFloat(d[attr]);
- 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 97.
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 checkTimeLimits
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
checkTimeLimits() {
//if all hooks are ready, check time limits and set time model to ready
if ([...this.hooksToListen].every(hook => hook._ready)) {
const minArray = [this.startOrigin], maxArray = [this.endOrigin];
if (!this.showForecast) maxArray.push(this.endBeforeForecast);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _enableSearch
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
_enableSearch() {
const _this = this;
const input = this.wrapper.select("." + css.search);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function comparePlainObjects
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const comparePlainObjects = function(a, b) {
//Returns the object's class, Array, Date, RegExp, Object are of interest to us
const getClass = function(val) {
return Object.prototype.toString.call(val)
Function resize
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
resize() {
const _this = this;
this.profiles = {
Function highlightValueRun
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
axis.highlightValueRun = function(g) {
//if viewport is defined and HL value is outside then behave as reset HL
if (options.viewportLength && highlightValue != "none" && (
axis.scale()(highlightValue) > options.viewportLength ||
Labels
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
const Labels = Class.extend({
init(context, conditions) {
const _this = this;
this.context = context;
Function validate
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
validate() {
//check if time start and end are not defined but start and end origins are defined
if (this.start == null && this.startOrigin) this.set("start", this.startOrigin, null, false);
if (this.end == null && this.endOrigin) this.set("end", this.endOrigin, null, false);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function positionLabel
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
positionLabel(d, index, cache, context, duration, showhide, lineGroup, position) {
const KEY = this.KEY;
const cached = cache || this.cached[d[KEY]];
const lockPosition = (position || position === 0);
Function resolver
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resolver(g) {
if (selector == null) {
console.warn("D3 collision resolver stopped: missing a CSS slector");
return;
}
Function readyOnce
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
readyOnce() {
const _this = this;
//DOM to d3
Function init
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
init(config, context) {
this.name = "gapminder-indicatorpicker";
this.template = '<span class="vzb-ip-holder"><span class="vzb-ip-select"></span><span class="vzb-ip-info"></span></span>';
Similar blocks of code found in 2 locations. Consider refactoring. Open
labelGroup
.style("opacity", 1)
.transition().duration(duration).ease(d3.easeExp)
.style("opacity", 0)
.on("end", () => {
- 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 90.
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
lineGroup
.style("opacity", 1)
.transition().duration(duration).ease(d3.easeExp)
.style("opacity", 0)
.on("end", () => {
- 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 90.
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 label
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function label(container, isTooltip) {
container
.each(function(d, index) {
const view = d3.select(this);
Menu
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
const Menu = Class.extend({
init(parent, menu, options) {
const _this = this;
this.parent = parent;
this.OPTIONS = options;
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (d3.event.selection && d3.event.selection[0] == d3.event.selection[1]) {
const brushDatum = _this.sliderEl.node().__brush;
brushDatum.selection[1][0] += 0.01;
}
- 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 88.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (d3.event.selection && d3.event.selection[0] == d3.event.selection[1]) {
const brushDatum = _this.sliderEl.node().__brush;
brushDatum.selection[1][0] += 0.01;
}
- 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 88.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- 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 repositionLabelsThatStickOut
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
function repositionLabelsThatStickOut(tickValues, options, orient, scale, dimension) {
if (!tickValues) return null;
const result = {};
// make an abstraction layer for margin sizes