Function interpreter
has a Cognitive Complexity of 132 (exceeds 5 allowed). Consider refactoring. Open
async interpreter(cmd) {
cmd = cmd.trim();
let cmdArgs, splitArgs;
debug("cmd %s", cmd);
- 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 interpreter
has 399 lines of code (exceeds 25 allowed). Consider refactoring. Open
async interpreter(cmd) {
cmd = cmd.trim();
let cmdArgs, splitArgs;
debug("cmd %s", cmd);
File interpreter.js
has 698 lines of code (exceeds 250 allowed). Consider refactoring. Open
const debugModule = require("debug");
const debug = debugModule("lib:debug:interpreter");
const path = require("path");
const util = require("util");
Function determineBreakpoints
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
determineBreakpoints(args) {
const currentLocation = this.session.view(controller.current.location);
const currentStart = currentLocation.sourceRange
? currentLocation.sourceRange.start
Function determineBreakpoints
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
determineBreakpoints(args) {
const currentLocation = this.session.view(controller.current.location);
const currentStart = currentLocation.sourceRange
? currentLocation.sourceRange.start
- 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 setOrClearBreakpointObject
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
async setOrClearBreakpointObject(breakpoint, setOrClear) {
const existingBreakpoints = this.session.view(controller.breakpoints);
//OK, we've constructed the breakpoint! But if we're adding, we'll
//want to adjust to make sure we don't set it on an empty line or
//anything like that
Function setOrClearBreakpointObject
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async setOrClearBreakpointObject(breakpoint, setOrClear) {
const existingBreakpoints = this.session.view(controller.breakpoints);
//OK, we've constructed the breakpoint! But if we're adding, we'll
//want to adjust to make sure we don't set it on an empty line or
//anything like that
- 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 updatePrintouts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
updatePrintouts(userArgs, selections, printOuts) {
let tempPrintouts = new Set();
for (let argument of userArgs) {
let fullSelection;
if (argument[0] === "+" || argument[0] === "-") {
- 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
Avoid deeply nested control flow statements. Open
if (
matchingSources.some(shortSource =>
matchingSources.every(
source =>
typeof source.sourcePath !== "string" || //just ignore these I guess?
Avoid deeply nested control flow statements. Open
if (errorIndex !== null) {
const stepSpinner = new Spinner(
"core:debug:interpreter:step",
"Stepping..."
);
Function parsePrintoutLines
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
parsePrintoutLines(userArgs, currentLines) {
let { beforeLines, afterLines } = currentLines;
for (const argument of userArgs) {
// ignore an option with length less than 2,such as a bare + or -
if (argument.length < 2) continue;
- 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 setOrClearBreakpoint
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async setOrClearBreakpoint(args, setOrClear) {
const breakpoints = this.determineBreakpoints(args); //note: not pure, can print
if (breakpoints !== null) {
for (const breakpoint of breakpoints) {
await this.setOrClearBreakpointObject(breakpoint, setOrClear);
- 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
Avoid too many return
statements within this function. Open
return [];
Avoid too many return
statements within this function. Open
return [];
Avoid too many return
statements within this function. Open
return [];
Avoid too many return
statements within this function. Open
return [
{
sourceId: currentSourceId,
line: line - 1 //adjust for zero-indexing!
}
Avoid too many return
statements within this function. Open
return [
{
sourceId: matchingSources[0].id,
line: line - 1 //adjust for zero-indexing!
}
Avoid too many return
statements within this function. Open
return [
{
sourceId: currentSourceId,
line: currentLine + delta
}
Avoid too many return
statements within this function. Open
return [];
Avoid too many return
statements within this function. Open
return [];
Avoid too many return
statements within this function. Open
return matchingSources.map(source => ({
sourceId: source.id,
line: line - 1 //adjust for breakpoint!
}));
Avoid too many return
statements within this function. Open
return [];
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (this.session.view(session.status.loaded)) {
const errorIndex = this.session.view(
stacktrace.current.innerErrorIndex
);
if (errorIndex !== null) {
- 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 116.
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 (!this.session.view(evm.current.step.isExceptionalHalting)) {
const errorIndex = this.session.view(
stacktrace.current.innerErrorIndex
);
if (errorIndex !== null) {
- 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 116.
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
let sourceNames = Object.assign(
//note: only include user sources
{},
...Object.entries(sources).map(([id, source]) => ({
[id]: path.basename(source.sourcePath)
- 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 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
- 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 (this.session.view(session.status.loaded)) {
this.printer.printAddressesAffected();
this.printer.warnIfNoSteps();
this.printer.printFile();
this.printer.printState();
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!loadFailed) {
this.printer.printAddressesAffected();
this.printer.warnIfNoSteps();
this.printer.printFile();
this.printer.printState();
- 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
existingBreakpoint.sourceId === breakpoint.sourceId &&
existingBreakpoint.line === breakpoint.line &&
existingBreakpoint.node === breakpoint.node //may be undefined
- 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 45.
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