Showing 303 of 303 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
} else {
elmts.push(
{
id: id++,
type: targetNode.type,
- 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 73.
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
if (countAttr === query.NEO4J_INTERNAL_ID) {
queryReturnElements.push("count(DISTINCT ID(" + countedNode.internalLabel + ")) as count");
} else {
queryReturnElements.push("count(DISTINCT " + countedNode.internalLabel + "." + countAttr + ") as count");
}
- 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 73.
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 expandNode
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
node.expandNode = function (clickedNode) {
graph.notifyListeners(graph.Events.GRAPH_NODE_VALUE_EXPAND, [clickedNode]);
// Get subset of node corresponding to the current node page and page size
Function generateNodeValueConstraints
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
query.generateNodeValueConstraints = function (node, useCustomConstraints) {
if (useCustomConstraints && provider.node.getGenerateNodeValueConstraints(node) !== undefined) {
return provider.node.getGenerateNodeValueConstraints(node)(node);
} else {
var parameters = {}, whereElements = [];
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
textRenderer.render = function (nodeSelection) {
var backgroundRectSelection = nodeSelection
.append("rect")
.attr("fill", function (node) {
Function chooseNodeClick
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
node.chooseNodeClick = function (clickedNode) {
logger.debug("chooseNodeClick (" + clickedNode.label + ") with waiting state set to " + node.chooseWaiting);
if (!node.chooseWaiting && !clickedNode.immutable && !(clickedNode.count === 0)) {
// Collapse all expanded nodes first
Function removeExpandedValue
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
node.removeExpandedValue = function (attribute, value) {
var isAnyChangeDone = false;
// For each expanded nodes in reverse order as some values can be removed
for (var i = dataModel.nodes.length - 1; i >= 0; i--) {
- 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 generateNodeValueQuery
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
query.generateNodeValueQuery = function (targetNode) {
var negativeElements = query.generateNegativeQueryElements();
var rootNode = dataModel.getRootNode();
var queryElements = query.generateQueryElements(rootNode, targetNode, query.getRelevantLinks(rootNode, targetNode, dataModel.links), true, false);
var queryMatchElements = queryElements.matchElements,
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
gMiddlegroundSymbolNodes.append("circle").attr("r", function (n) {
return provider.node.getSize(n);
})
.attr("class", function (n) {
return provider.node.getCSSClass(n, "symbol-background-circle")
- 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 70.
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
gMiddlegroundImageNodes.append("circle").attr("r", function (n) {
return provider.node.getSize(n);
})
.attr("class", function (n) {
return provider.node.getCSSClass(n, "image-background-circle")
- 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 70.
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 updateAutoLoadValues
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
node.updateAutoLoadValues = function () {
var statements = [];
var nodesToLoadData = node.getAutoLoadValueNodes();
Function updateElements
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
node.updateElements = function () {
var toUpdateElem = graph.svg.select("#" + node.gID).selectAll(".ppt-gnode");
toUpdateElem.attr("id", function (d) {
return "popoto-gnode_" + d.id;
Function loadSchemaRelation
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
graph.loadSchemaRelation = function (relationSchema, parentNode, linkIndex, parentLinkTotalCount) {
var targetNodeSchema = relationSchema.target;
var target = graph.loadSchemaNode(targetNodeSchema, parentNode, linkIndex, parentLinkTotalCount, relationSchema.label, (relationSchema.hasOwnProperty("isReverse") && relationSchema.isReverse === true));
var newLink = {
Function toggleFullScreen
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
tools.toggleFullScreen = function () {
var elem = document.getElementById(graph.containerId);
if (!document.fullscreenElement && // alternative standard method
- 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 start
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function start(startParam) {
logger.info("Popoto " + version + " start on " + startParam);
graph.mainLabel = startParam;
- 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 updateCount
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
node.updateCount = function () {
var statements = [];
var countedNodes = dataModel.nodes
.filter(function (d) {
Function generateData
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
queryviewer.generateData = function (links, nodes) {
var elmts = [], options = [], id = 0;
// Add a span for each link and its target node
links.forEach(function (l) {
Function addSchema
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
graph.addSchema = function (graphSchema) {
if (dataModel.nodes.length > 0) {
logger.warn("graph.addSchema is called but the graph is not empty.");
}
Similar blocks of code found in 4 locations. Consider refactoring. Open
if (tools.TOGGLE_FULL_SCREEN) {
toolbar.append("span")
.attr("id", "popoto-fullscreen-menu")
.attr("class", "ppt-icon ppt-menu fullscreen")
.attr("title", toolbar.TOOL_FULL_SCREEN)
- 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 66.
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
if (tools.TOGGLE_FIT_TEXT) {
toolbar.append("span")
.attr("id", "popoto-fit-text-menu")
.attr("class", "ppt-icon ppt-menu fit-text")
.attr("title", toolbar.TOOL_FIT_TEXT)
- 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 66.
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