Showing 165 of 165 total issues
File transitive.ts
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable camelcase */ // FIXME remove camel case
/* globals Display */
import d3 from 'd3'
import Emitter from 'component-emitter'
Function addSegmentsToQuadtree
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
addSegmentsToQuadtree() {
forEach(this.transitive.renderSegments, (segment) => {
if (segment.getType() !== 'TRANSIT') return
let lw = this.transitive.style.compute(
Similar blocks of code found in 2 locations. Consider refactoring. Open
addPathSegment(pathSegment) {
if (!this.pathSegments) this.pathSegments = []
if (this.pathSegments.indexOf(pathSegment) !== -1) return
this.pathSegments.push(pathSegment)
- 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 92.
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
addPattern(pattern) {
if (!this.patterns) this.patterns = []
if (this.patterns.indexOf(pattern) !== -1) return
this.patterns.push(pattern)
- 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 92.
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 apply2DOffsets
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
apply2DOffsets() {
this.initComparisons()
const alignmentBundles = {} // maps alignment ID to array of range-bounded bundles on that alignment
Function constructMergedMarker
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructMergedMarker(display) {
const dataArray = this.getRenderDataArray()
const xValues = []
const yValues = []
dataArray.forEach(function (data) {
Function splitEdgeAtInternalPoints
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
splitEdgeAtInternalPoints(edge, points) {
let subEdgePoints = []
let newEdge
const newEdgeInfoArr = []
let fromVertex = edge.fromVertex
Function constructor
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(data, network) {
this.network = network
for (const key in data) {
this[key] = data[key]
File styles.js
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
import d3 from 'd3'
/**
* Scales for utility functions to use
*/
Function getBBox
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
getBBox() {
if (this.orientation === 'E') {
return {
height: this.textHeight,
width: this.textWidth,
Function getRenderCoords
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
getRenderCoords(fromOffsetPx, toOffsetPx, display, forward) {
const isBase = fromOffsetPx === 0 && toOffsetPx === 0
if (!this.baseRenderCoords && !isBase) {
this.calculateBaseRenderCoords(display)
- 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 calculateGeometry
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
calculateGeometry(cellSize, angleConstraint) {
// if(!this.hasTransit()) angleConstraint = 5;
angleConstraint = angleConstraint || 45
this.angleConstraintR = (angleConstraint * Math.PI) / 180
- 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 constructor
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(transitive) {
this.transitive = transitive
this.clusters = []
this.clusterLookup = {} // maps Point object to its containing cluster
Identical blocks of code found in 2 locations. Consider refactoring. Open
intersects(obj) {
if (obj instanceof Label) {
// todo: handle label-label intersection for diagonally placed labels separately
return this.intersectsBBox(obj.getBBox())
} else if (obj.x && obj.y && obj.width && obj.height) {
- 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 85.
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
intersects(obj) {
if (obj instanceof Label) {
// todo: handle label-label intersection for diagonally placed labels separately
return this.intersectsBBox(obj.getBBox())
} else if (obj.x && obj.y && obj.width && obj.height) {
- 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 85.
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 refreshRenderData
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
refreshRenderData(display) {
if (
this.graphEdge.fromVertex.x === this.graphEdge.toVertex.x &&
this.graphEdge.fromVertex.y === this.graphEdge.toVertex.y
) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
color: [
'#fff', // Text color falls back on white.
function (display, segment) {
if (segment.type === 'TRANSIT') {
if (segment.patterns) {
- 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 84.
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
background: [
'#008', // Background color falls back on dark blue.
function (display, segment) {
if (segment.type === 'TRANSIT') {
if (segment.patterns) {
- 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 84.
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 calculateGeometry
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
calculateGeometry(cellSize, angleConstraint) {
// if(!this.hasTransit()) angleConstraint = 5;
angleConstraint = angleConstraint || 45
this.angleConstraintR = (angleConstraint * Math.PI) / 180
Function intersect
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
intersect(rEdge) {
// do no intersect adjacent edges of unequal bundle size
if (
this.graphEdge.renderedEdges.length !==
rEdge.graphEdge.renderedEdges.length
- 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"