trufflesuite/truffle

View on GitHub

Showing 685 of 1,401 total issues

Function sources has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function sources(state = DEFAULT_SOURCES, action) {
  switch (action.type) {
    /*
     * Adding new sources
     */
Severity: Minor
Found in packages/debugger/lib/sourcemapping/reducers.js - About 1 hr to fix

    Function yulWalk has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function* yulWalk(
      sourceId,
      sourceIndex,
      node,
      pointer,
    Severity: Minor
    Found in packages/debugger/lib/ast/sagas/index.js - About 1 hr to fix

      Function startDebugger has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async startDebugger(compilations) {
          const startMessage = DebugUtils.formatStartMessage(
            this.txHash !== undefined
          );
          const specifiedRegistry = this.config.noEns ? null : this.config.registry; //specified at the command line
      Severity: Minor
      Found in packages/core/lib/debug/cli.js - About 1 hr to fix

        Function forAddress has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public async forAddress(
            address: string,
            block: Codec.BlockSpecifier = "latest"
          ): Promise<ContractInstanceEncoder> {
            //code duplication warning: this method is basically copypasted
        Severity: Minor
        Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

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

            async resolve(
              importPath: string,
              importedFrom: string = "",
              options: { compiler?: { name: string; version: string } } = {}
            ) {
          Severity: Minor
          Found in packages/resolver/lib/sources/abi.ts - About 1 hr to fix

            Function parseImports has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              parseImports(body, solc) {
                // WARNING: Kind of a hack (an expedient one).
            
                // So we don't have to maintain a separate parser, we'll get all the imports
                // in a file by sending the file to solc and evaluating the error messages
            Severity: Minor
            Found in packages/compile-solidity/src/parser.ts - About 1 hr to fix

              Function forContract has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function forContract(contract: CompiledContract): any {
                const {
                  contractName,
                  sourcePath,
                  source,
              Severity: Minor
              Found in packages/compile-common/src/shims/NewToLegacy.ts - About 1 hr to fix

                Function inspectTransaction has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function* inspectTransaction(txHash) {
                  debug("putting");
                  yield put(actions.inspect(txHash));
                
                  debug("waiting");
                Severity: Minor
                Found in packages/debugger/lib/web3/sagas/index.js - About 1 hr to fix

                  Function processTrace has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function* processTrace(steps) {
                    yield put(actions.saveSteps(steps));
                  
                    let callAddresses = new Set();
                    let selfDestructAddresses = new Set();
                  Severity: Minor
                  Found in packages/debugger/lib/trace/sagas/index.js - About 1 hr to fix

                    Function send has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      send: function (fn, methodABI, address) {
                        const constructor = this;
                        const web3 = constructor.web3;
                    
                        return function () {
                    Severity: Minor
                    Found in packages/contract/lib/execute.js - About 1 hr to fix

                      Function event has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        event: function (fn) {
                          const constructor = this;
                          const decode = utils.decodeLogs;
                          let currentLogID = null;
                      
                      
                      Severity: Minor
                      Found in packages/contract/lib/execute.js - About 1 hr to fix

                        Function RPCs has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function RPCs(): JSX.Element {
                          const { state } = useDash()!;
                          const { classes } = useStyles();
                        
                          const content = Array.from(
                        Severity: Minor
                        Found in packages/dashboard/src/components/composed/RPCs/index.tsx - About 1 hr to fix

                          Function _decode has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                            _decode: function (rawData, web3) {
                              const errorStringHash = "0x08c379a0";
                              const panicCodeHash = "0x4e487b71";
                              const selectorLength = 2 + 2 * 4; //0x then 4 bytes (0x then 8 hex digits)
                              const wordLength = 2 * 32; //32 bytes (64 hex digits)
                          Severity: Minor
                          Found in packages/contract/lib/reason.js - About 1 hr 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 compile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                            compile: async function (options, callback) {
                              const callbackPassed = typeof callback === "function";
                              try {
                                const config = prepareConfig(options);
                          
                          
                          Severity: Minor
                          Found in packages/workflow-compile/legacy/index.js - About 1 hr 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 decodeTransactionBySelector has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                            private async decodeTransactionBySelector(
                              transaction: DecoderTypes.Transaction,
                              data: Uint8Array, //this is redundant but included for convenience
                              additionalContexts: Contexts.Contexts,
                              context: Contexts.Context | null
                          Severity: Minor
                          Found in packages/decoder/lib/decoders.ts - About 1 hr 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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                            public async decodeTransactionWithAdditionalContexts(
                              transaction: DecoderTypes.Transaction,
                              additionalContexts: Contexts.Contexts = {},
                              additionalAllocations?: {
                                [
                          Severity: Minor
                          Found in packages/decoder/lib/decoders.ts - About 1 hr 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 preserve has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export async function* preserve(
                            options: PreserveOptions
                          ): AsyncIterable<Event> {
                            const { request, recipes } = options;
                            const { recipe } = request;
                          Severity: Minor
                          Found in packages/preserve/lib/preserve.ts - About 1 hr 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 parseImports has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                            parseImports(body, solc) {
                              // WARNING: Kind of a hack (an expedient one).
                          
                              // So we don't have to maintain a separate parser, we'll get all the imports
                              // in a file by sending the file to solc and evaluating the error messages
                          Severity: Minor
                          Found in packages/compile-solidity/src/parser.ts - About 1 hr 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 readAndParseArtifactFiles has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function readAndParseArtifactFiles(
                            paths: string[],
                            contracts_build_directory: string
                          ): SourceFilesArtifacts {
                            const sourceFilesArtifacts: SourceFilesArtifacts = {};
                          Severity: Minor
                          Found in packages/profiler/src/updated.ts - About 1 hr 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 method has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                    var method = function (constant, web3Method) {
                                      var fn;
                          
                                      constant
                                        ? (fn = execute.call.call(
                          Severity: Minor
                          Found in packages/contract/lib/contract/index.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language