Showing 685 of 1,401 total issues
Function iterate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
*iterate({ inputs }) {
for (const [compilationIndex, { sources, contracts }] of inputs.entries()) {
for (const [sourceIndex, source] of sources.entries()) {
yield {
input: source,
- 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 interpretCallInAggregate
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async interpretCallInAggregate(
callResult: Format.Values.StructResult | Format.Values.TupleResult,
transaction: DecoderTypes.Transaction,
additionalContexts: Contexts.Contexts = {},
additionalAllocations?: {
Function isUsableCompilation
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
isUsableCompilation: function (compilation) {
//check #1: is the source order reliable?
if (compilation.unreliableSourceOrder) {
debug("unreliable source order");
return false;
Function parseParameterListWithRemainder
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseParameterListWithRemainder(parameterList: string): {
parameters: Parameter[];
remaining: string;
} {
if (parameterList === "") {
Function save
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async save<N extends CollectionName<C>, T>(
collectionName: N,
records: (Record<T> | undefined)[],
options: { overwrite?: boolean } = {}
): Promise<(SavedRecord<T> | undefined)[]> {
File index.tsx
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { useState, useEffect } from "react";
import { Input, Button, Header, Grid, createStyles } from "@mantine/core";
import { useInputState, useCounter, useLocalStorage } from "@mantine/hooks";
import Controls from "src/components/composed/Debugger/Controls";
import Sources from "src/components/composed/Debugger/Sources";
File run.js
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module.exports = async function (options) {
const debug = require("debug")("core:commands:call");
const fs = require("fs");
const util = require("util");
const { Environment } = require("@truffle/environment");
Function decodeCall
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Function decode
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function* decode(definition, ref, compilationId) {
const userDefinedTypes = yield select(data.views.userDefinedTypes);
const state = yield select(data.current.state);
const mappingKeys = yield select(data.views.mappingKeys);
const allocations = yield select(data.info.allocations);
Function parseQuotesAndEscapes
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseQuotesAndEscapes(args, escapeCharacters = "\\") {
const quoteCharacters = "\"'"; //note we will handle the two quote types differently
let argArray = [];
let currentArg = "";
let currentQuote = undefined;
Function sourcesWithDependencies
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async sourcesWithDependencies({
paths,
options
}: SourcesWithDependenciesArgs) {
if (options.compilers.solc.version === "pragma") {
File adapter.ts
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import debugModule from "debug";
const debug = debugModule("decoder:adapter");
import type { BlockSpecifier } from "@truffle/codec";
import type BN from "bn.js";
import type {
File VersionRange.ts
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import debugModule from "debug";
const debug = debugModule("compile:compilerSupplier");
import requireFromString from "require-from-string";
Function _
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
...Object.entries(scopes).map(([id, scope]) => {
let definition = inlined[id].definition;
if (definition.nodeType === "ContractDefinition") {
//contract definition case: process inheritance
debug("contract id %d", id);
Function start
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
start: async function (context, web3Error) {
const constructor = this;
let currentBlock = override.defaultMaxBlocks;
// Reject after attempting to get reason string if we shouldn't be waiting.
Function link
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
link: async function (library, destinations, deployer) {
let eventArgs;
let libraryName = library.contractName;
if (libraryName == null && library.constructor) {
//allow for the possibility that library is an instance rather
Function exports
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = async options => {
const { Develop } = require("@truffle/environment");
const Config = require("@truffle/config");
const config = Config.detect(options);
Function decodeVariable
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async decodeVariable(
variable: Storage.Allocate.StateVariableAllocation,
block: RegularizedBlockSpecifier
): Promise<DecoderTypes.StateVariable> {
const info: Codec.Evm.EvmInfo = {
Function process
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function* process(options: {
networks: (Pick<Resource<"networks">, "id" | "historicBlock"> | undefined)[];
settings?: {
disableIndex?: boolean;
};
File webpack.config.js
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const webpack = require("webpack");
const pkg = require("./package.json");