Function isDesignatedInvalid
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
isDesignatedInvalid: function (
instructions,
index,
overlapFunctions,
node = undefined
- 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
File index.js
has 404 lines of code (exceeds 250 allowed). Consider refactoring. Open
const debug = require("debug")("source-map-utils");
const CodeUtils = require("@truffle/code-utils");
const Codec = require("@truffle/codec");
const Web3Utils = require("web3-utils");
const jsonpointer = require("json-pointer");
Function isDesignatedInvalid
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
isDesignatedInvalid: function (
instructions,
index,
overlapFunctions,
node = undefined
Function getFunctionsByProgramCounter
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
getFunctionsByProgramCounter: function (
instructions,
asts,
overlapFunctions,
compilationId
- 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 getFunctionsByProgramCounter
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
getFunctionsByProgramCounter: function (
instructions,
asts,
overlapFunctions,
compilationId
Function getProcessedInstructionsForBinary
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
getProcessedInstructionsForBinary: function (sources, binary, sourceMap) {
if (!sources || !binary) {
return [];
}
debug("sourceMap: %O", sourceMap);
Function getHumanReadableSourceMap
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
getHumanReadableSourceMap: function (sourceMap) {
const instructions = sourceMap.split(";");
let processedInstruction = {
start: 0,
Function getHumanReadableSourceMap
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
getHumanReadableSourceMap: function (sourceMap) {
const instructions = sourceMap.split(";");
let processedInstruction = {
start: 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 too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return parseInt(instructions[index].pushData);
Avoid too many return
statements within this function. Open
return {
[instruction.pc]: {
sourceIndex,
compilationId,
//note: we're assuming that functions in generated sources are never pointed to
Function getProcessedInstructionsForBinary
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getProcessedInstructionsForBinary: function (sources, binary, sourceMap) {
if (!sources || !binary) {
return [];
}
debug("sourceMap: %O", sourceMap);
- 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 rangeNodes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
rangeNodes: function (node, pointer = "") {
if (node instanceof Array) {
return [].concat(
...node.map((sub, i) =>
SourceMapUtils.rangeNodes(sub, `${pointer}/${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"