Showing 1,401 of 1,401 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
export interface DashboardMessageBusClientOptions {
host?: string;
port?: number;
subscribePort?: number;
publishPort?: number;
- 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 51.
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
gasprice: yield* Basic.Decode.decodeBasic(
{
typeClass: "uint" as const,
bits: 256
},
- 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 51.
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
block.prevrandao = yield* Basic.Decode.decodeBasic(
{
typeClass: "uint" as const,
bits: 256
},
- 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 51.
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 preparingSession =
status === SessionStatus.PreparingForInitialization ||
status === SessionStatus.Initializing ||
status === SessionStatus.Fetching ||
status === SessionStatus.Starting;
- 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 51.
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
Avoid deeply nested control flow statements. Open
if (!(yield select(txlog.current.waitingForInternalCallToAbsorb))) {
const newPointer = yield select(txlog.current.nextActionPointer);
debug("internal call: %o %o", pointer, newPointer);
yield put(actions.internalCall(pointer, newPointer, step));
} else {
Avoid deeply nested control flow statements. Open
for (let index in generatedSources) {
index = Number(index); //it comes out as a string due to in, so let's fix that
const source = generatedSources[index];
// VSCode extension breaks w/o this check
if (source) {
Avoid deeply nested control flow statements. Open
for (let index in deployedGeneratedSources) {
index = Number(index); //it comes out as a string due to in, so let's fix that
const source = deployedGeneratedSources[index];
// VSCode extension breaks w/o this check
if (source) {
Function decodeCall
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function* decodeCall(decodeCurrent = false) {
const isCall = yield select(data.current.isCall);
const isCreate = yield select(data.current.isCreate);
if (!isCall && !isCreate && !decodeCurrent) {
return null;
- 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 (!internal && astMatchesTxLog) {
//in this case, we have to do decoding & fn identification
const newPointer = yield select(txlog.current.internalReturnPointer);
const outputAllocations = yield select(
txlog.current.outputParameterAllocations
Avoid deeply nested control flow statements. Open
if (instant) {
const status = yield select(txlog.current.returnStatus);
debug("instacreate: %o %o", pointer, newPointer);
yield put(
actions.instantCreate(
Function fetchTransactionInfo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function* fetchTransactionInfo(adapter, { txHash }) {
debug("inspecting transaction");
var trace;
try {
trace = yield apply(adapter, adapter.getTrace, [txHash]);
- 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 continueUntilBreakpoint
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function* continueUntilBreakpoint(action) {
//if breakpoints was not specified, use the stored list from the state.
//if it was, override that with the specified list.
//note that explicitly specifying an empty list will advance to the end.
let breakpoints =
- 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 (Codec.Ast.Utils.isSimpleConstant(indexConstantDefinition)) {
debug("about to decode simple constant");
return yield* decode(
keyDefinition,
{
Avoid deeply nested control flow statements. Open
} else if (yield select(txlog.current.isLog)) {
const decoding = (yield* data.decodeLog())[0]; //just assume first decoding is correct
//(note: because we know the event ID, there should typically only be one decoding)
const rawInfo = yield select(txlog.current.rawEventInfo);
const newPointer = yield select(txlog.current.nextActionPointer);
Function yulWalk
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function* yulWalk(
sourceId,
sourceIndex,
node,
pointer,
- 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 processInput
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const processInput = input => {
const words = input.trim().split(/\s+/);
// empty input
if (words.length === 0) return input;
- 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 exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = async options => {
const TruffleError = require("@truffle/error");
const { Plugins } = require("@truffle/plugins");
const { getConfig, constructRecipes } = require("./plugins");
const { preserve, ConsoleReporter } = require("@truffle/preserve");
- 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 convertENSArgsNames
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
convertENSArgsNames: function ({
inputArgs,
methodABI,
web3,
registryAddress,
- 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 exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = async function (options) {
const Config = require("@truffle/config");
const WorkflowCompile = require("@truffle/workflow-compile").default;
const ConfigurationError = require("../../errors/configurationerror");
const exec = require("@truffle/require").exec;
- 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 (!whitespace) {
//if we're already on whitespace, we don't need
//to do anything, this is just more whitespace.
//if however we're transitioning to whitespace, that means we need
//to split arguments here.