Showing 685 of 1,401 total issues
Function decodeLiteral
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
export function* decodeLiteral(
dataType: Format.Types.Type,
pointer: Pointer.StackLiteralPointer,
info: Evm.EvmInfo
): Generator<DecoderRequest, Format.Values.Result, Uint8Array | 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
Function deriveConfigEnvironment
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const deriveConfigEnvironment = function (detectedConfig, network, url) {
let configuredNetwork;
const configDefinesProvider =
detectedConfig.networks[network] &&
Function exports
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = async function (options) {
const Config = require("@truffle/config");
const ConfigurationError = require("../../errors/configurationerror");
const create = require("./helpers");
Function exports
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
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");
Function readStorage
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function* readStorage(
pointer: Pointer.StoragePointer,
state: Evm.EvmState
): Generator<DecoderRequest, Uint8Array, Uint8Array | null> {
const { storage } = state;
Function process
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function* process(options: {
relationship: "ancestor" | "descendant";
network: IdObject<"networks">;
alreadyTried: string[];
disableIndex?: boolean;
Function forAttachAndSchema
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const forAttachAndSchema = <C extends Collections>(options: {
attach: (options: Pouch.Adapters.AttachOptions) => Workspace<C>;
schema: GraphQLSchema;
}) => {
const { attach, schema } = options;
Function decodeDispatch
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function* decodeDispatch(
dataType: Format.Types.Type,
pointer: Pointer.DataPointer,
info: Evm.EvmInfo,
options: DecoderOptions = {}
Function forContract
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function forContract(contract: any): CompiledContract {
const {
contractName,
contract_name,
sourcePath,
Function _
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(scopes, scope, pointer, sourceId, language) => {
let variables = {};
if (scope !== undefined) {
let cur =
scope.id !== undefined ? scope.id : makePath(sourceId, pointer);
Function exports
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = async function (options) {
const TruffleError = require("@truffle/error");
const WorkflowCompile = require("@truffle/workflow-compile").default;
const Config = require("@truffle/config");
const config = Config.detect(options);
Function execVyper
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function execVyper(options, sourcePath, version, callback) {
const formats = ["abi", "bytecode", "bytecode_runtime"];
debug("version: %s", version);
if (
semver.satisfies(version, ">=0.1.0-beta.7", {
Function exports
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = async function (selectedCommand, subCommand, options) {
const commands = require("../index");
const globalCommandOptions = require("../../global-command-options");
const TruffleError = require("@truffle/error");
Function decodeReturnValueWithAdditionalContexts
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async decodeReturnValueWithAdditionalContexts(
abi: Abi.FunctionEntry,
data: string,
options: DecoderTypes.ReturnOptions = {},
additionalContexts: Contexts.Contexts = {}
Function constructor
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(info: Types.EncoderInfoInternal) {
//first, set up the basic info that we need to run
if (info.userDefinedTypes && info.allocations) {
debug("internal route!");
this.userDefinedTypes = info.userDefinedTypes;
Function decodeMessage
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function decodeMessage(
lifecycle: ReceivedMessageLifecycle<DashboardProviderMessage>,
decoder: ProjectDecoder
) {
const method = lifecycle.message.payload.method as DecodableRpcMethod;
Function handleCompilations
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async (compilations: Compilation[], hashes?: string[]) => {
if (compilations.length === 0 || !stateRef.current.decoder) return;
let decoderNeedsUpdate = false;
const decoderCompilations = [...stateRef.current.decoderCompilations!];
Consider simplifying this complex logical expression. Open
Open
if (
isContextChange ||
!node ||
node.id === undefined ||
!next ||
Consider simplifying this complex logical expression. Open
Open
if (
decoding.kind === "function" &&
(decoding.abi.name === "aggregate" ||
decoding.abi.name === "blockAndAggregate") &&
decoding.abi.inputs.length === 1 &&
Consider simplifying this complex logical expression. Open
Open
} else if (
decoding.kind === "function" &&
decoding.abi.name === "aggregate3" &&
decoding.abi.inputs.length === 1 &&
decoding.abi.inputs[0].type === "tuple[]" &&