Showing 685 of 1,401 total issues
Function reducer
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export const reducer = (state: State, action: Action): State => {
const { type, data } = action;
switch (type) {
case "set-decoder":
return { ...state, ...data };
- 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 display
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
display: async function(config) {
const networks = await this.deployed(config);
const { networkNames, starNetworks } = Object.keys(networks)
.sort()
.reduce(
Function interpret
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
async interpret(input, context, filename, callback) {
const processedInput = processInput(input);
if (validTruffleConsoleCommands.includes(processedInput.split(/\s+/)[0])) {
try {
parseQuotesAndEscapes(processedInput); //we're just doing this to see
DebugUtils
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
var DebugUtils = {
truffleColors, //make these externally available
//panicCode may be either a number, BN, or decimal string
panicString: function (panicCode, verbose = false) {
Function normalizeSourcePath
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const normalizeSourcePath = (url = defaultPath) => {
// Process filepath resolution
//
if (url.startsWith(".") || url.startsWith("/") || url.startsWith("~")) {
debug({ in: url, out: path.normalize(url) });
Function resolveContractInstances
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function resolveContractInstances(
project: IdObject<"projects">,
inputs: {
contract?: DataModel.ResourceNameInput;
address?: string;
Function addCompilations
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async addCompilations(
compilations: Compilations.Compilation[]
): Promise<void> {
//first: make sure we're not adding a compilation with an existing ID
const existingIds = new Set(
Function mappedPaths
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mappedPaths(state = DEFAULT_PATHS, action) {
switch (action.type) {
case actions.MAP_PATH_AND_ASSIGN:
let { address, slot, typeIdentifier, parentType } = action;
//how this case works: first, we find the spot in our table (based on
Function markTextHighlighted
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function markTextHighlighted(source: Source, sourceRange: SourceRange) {
const fullyHighlightedLines = new Set<number>();
const editedLines = source.contents.split("\n").map((line, index) => {
if (line.length === 0) {
return line;
Function resolve
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
async resolve(
importModule: string,
importedFrom: string,
options: { compiler?: { name: string } } = {}
) {
- 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 sourcify.ts
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
import debugModule from "debug";
const debug = debugModule("source-fetcher:sourcify");
import type { Fetcher, FetcherConstructor } from "./types";
import type * as Types from "./types";
Function Variables
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Variables(): JSX.Element | null {
const { classes } = useStyles();
const {
state: {
debugger: { session }
Function tryFetchAndCompileAddress
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function tryFetchAndCompileAddress(
address: string,
fetchers: Fetcher[],
recognizer: Recognizer,
fetchAndCompileOptions: FetchAndCompileOptions
Function stacktraceSaga
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
function* stacktraceSaga() {
const currentLocation = yield select(stacktrace.current.strippedLocation);
const lastLocation = yield select(stacktrace.current.lastPosition);
const returnCounter = yield select(stacktrace.current.returnCounter);
let positionUpdated = false;
Function exports
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = async function (options) {
const OS = require("os");
const { promisify } = require("util");
const loadConfig = require("../../loadConfig");
const { Environment } = require("@truffle/environment");
File schema.ts
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { logger } from "@truffle/db/logger";
const debug = logger("db:meta:graph:schema");
import gql from "graphql-tag";
import type * as graphql from "graphql";
Function continueUntilBreakpoint
has 69 lines of code (exceeds 25 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 =
Function interpretCallInAggregate
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private async interpretCallInAggregate(
callResult: Format.Values.StructResult | Format.Values.TupleResult,
transaction: DecoderTypes.Transaction,
additionalContexts: Contexts.Contexts = {},
additionalAllocations?: {
- 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 run
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function run(
rawSources: { [name: string]: string },
options: Config,
internalOptions: InternalOptions = {}
): Promise<Compilation | null> {
Function resolve
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
async resolve(
importModule: string,
importedFrom: string,
options: { compiler?: { name: string } } = {}
) {