trufflesuite/truffle

View on GitHub

Showing 685 of 1,401 total issues

Function MantineGlobal has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function MantineGlobal(): JSX.Element {
  return (
    <Global
      styles={theme => {
        const { colors, colorScheme, white, fn } = theme;
Severity: Major
Found in packages/dashboard/src/components/MantineGlobal.tsx - About 4 hrs to fix

    Function parseQuotesAndEscapes has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function parseQuotesAndEscapes(args, escapeCharacters = "\\") {
      const quoteCharacters = "\"'"; //note we will handle the two quote types differently
      let argArray = [];
      let currentArg = "";
      let currentQuote = undefined;
    Severity: Minor
    Found in packages/core/lib/command-utils.js - About 4 hrs to fix

    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 etherscan.ts has 335 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import debugModule from "debug";
    const debug = debugModule("source-fetcher:etherscan");
    // untyped import since no @types/web3-utils exists
    const Web3Utils = require("web3-utils");
    
    
    Severity: Minor
    Found in packages/source-fetcher/lib/etherscan.ts - About 4 hrs to fix

      data has 32 functions (exceeds 20 allowed). Consider refactoring.
      Open

        current: {
          /**
           * data.current.state
           */
          state: {
      Severity: Minor
      Found in packages/debugger/lib/data/selectors/index.js - About 4 hrs to fix

        Function constructSlot has 97 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private async constructSlot(
            variable: number | string,
            ...indices: unknown[]
          ): Promise<{ slot?: Storage.Slot; type?: Format.Types.Type }> {
            //base case: we need to locate the variable and its definition
        Severity: Major
        Found in packages/decoder/lib/decoders.ts - About 3 hrs to fix

          Function resolve has 95 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async resolve(importPath: string) {
              if (importPath === `truffle${path.sep}DeployedAddresses.sol`) {
                const sourceFiles = await findContracts(this.options.contracts_directory);
          
                const buildDirFiles: string[] = fse.existsSync(
          Severity: Major
          Found in packages/resolver/lib/sources/truffle/index.ts - About 3 hrs to fix

            Function errors has 94 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              errors(kind, data) {
                const prefix = " *** Deployment Failed ***\n\n";
            
                const kinds = {
                  migrateErr: () =>
            Severity: Major
            Found in packages/events/defaultSubscribers/migrate/Messages.js - About 3 hrs to fix

              Function parseParameterListWithRemainder has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
              Open

              function parseParameterListWithRemainder(parameterList: string): {
                parameters: Parameter[];
                remaining: string;
              } {
                if (parameterList === "") {
              Severity: Minor
              Found in packages/abi-utils/lib/parse.ts - About 3 hrs to fix

              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 decodeTransactionWithAdditionalContexts has 93 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public async decodeTransactionWithAdditionalContexts(
                  transaction: DecoderTypes.Transaction,
                  additionalContexts: Contexts.Contexts = {},
                  additionalAllocations?: {
                    [
              Severity: Major
              Found in packages/decoder/lib/decoders.ts - About 3 hrs to fix

                Function abiParameterToType has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function abiParameterToType(abi: Parameter): Format.Types.Type {
                  let typeName = abi.type;
                  let typeHint = abi.internalType;
                  //first: is it an array?
                  let arrayMatch = typeName.match(/(.*)\[(\d*)\]$/);
                Severity: Major
                Found in packages/codec/lib/abi-data/import/index.ts - About 3 hrs to fix

                  Function resolveRelations has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function resolveRelations(relationship: "ancestor" | "descendant") {
                    const {
                      reverseRelationship,
                      superlativeOption,
                      heightBoundOption,
                  Severity: Major
                  Found in packages/db/src/resources/networks/resolveRelations.ts - About 3 hrs to fix

                    Spinner has 30 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export class Spinner {
                      name: string;
                    
                      constructor(name: string, options: Partial<SpinnerOptions>);
                      constructor(name: string, text: string);
                    Severity: Minor
                    Found in packages/spinners/lib/spinner.ts - About 3 hrs to fix

                      Function refs has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                              (
                                assignments,
                                identifiers,
                                definitions,
                                scopes,
                      Severity: Minor
                      Found in packages/debugger/lib/data/selectors/index.js - About 3 hrs to fix

                      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 useStyles has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const useStyles = createStyles((theme, _params, getRef) => {
                        const {
                          colors,
                          colorScheme,
                          white,
                      Severity: Major
                      Found in packages/dashboard/src/components/composed/RPCs/RPC/Overview.tsx - About 3 hrs to fix

                        Function start has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async start() {
                            if (this.httpServer?.listening) {
                              return;
                            }
                        
                        
                        Severity: Major
                        Found in packages/dashboard/lib/DashboardServer.ts - About 3 hrs to fix

                          Function getFunctionsByProgramCounter has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                          Open

                            getFunctionsByProgramCounter: function (
                              instructions,
                              asts,
                              overlapFunctions,
                              compilationId
                          Severity: Minor
                          Found in packages/source-map-utils/index.js - About 3 hrs to fix

                          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 parseCode has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function parseCode(
                            hexString: string,
                            { maxInstructionCount, attemptStripMetadata }: DisassemblyOptions = {}
                          ): Instruction[] {
                            // Convert to an array of bytes
                          Severity: Minor
                          Found in packages/code-utils/src/index.ts - About 3 hrs to fix

                          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 interpretAggregate has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private async interpretAggregate(
                              decoding: Codec.CalldataDecoding,
                              transaction: DecoderTypes.Transaction,
                              additionalContexts: Contexts.Contexts = {},
                              additionalAllocations?: {
                          Severity: Major
                          Found in packages/decoder/lib/decoders.ts - About 3 hrs to fix

                            File DashProvider.tsx has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { useReducer, useEffect, useRef, useMemo, useCallback } from "react";
                            import { useAccount, useNetwork } from "wagmi";
                            import { sha1 } from "object-hash";
                            import { deleteDB } from "idb/with-async-ittr";
                            import type { ReceivedMessageLifecycle } from "@truffle/dashboard-message-bus-client";
                            Severity: Minor
                            Found in packages/dashboard/src/contexts/DashContext/DashProvider.tsx - About 3 hrs to fix

                              Function executeDeployment has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                executeDeployment(contract, args) {
                                  const self = this;
                                  return async function () {
                                    await self._preFlightCheck(contract);
                              
                              
                              Severity: Major
                              Found in packages/deployer/src/deployment.js - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language