trufflesuite/truffle

View on GitHub

Showing 685 of 1,401 total issues

File decoders.ts has 1877 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import debugModule from "debug";
const debug = debugModule("decoder:decoders");

import * as Abi from "@truffle/abi-utils";
import * as Codec from "@truffle/codec";
Severity: Major
Found in packages/decoder/lib/decoders.ts - About 5 days to fix

    File index.js has 1227 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import debugModule from "debug";
    const debug = debugModule("debugger:data:selectors");
    
    import { createSelectorTree, createLeaf } from "reselect-tree";
    import jsonpointer from "json-pointer";
    Severity: Major
    Found in packages/debugger/lib/data/selectors/index.js - About 3 days to fix

      Function interpreter has a Cognitive Complexity of 132 (exceeds 5 allowed). Consider refactoring.
      Open

        async interpreter(cmd) {
          cmd = cmd.trim();
          let cmdArgs, splitArgs;
          debug("cmd %s", cmd);
      
      
      Severity: Minor
      Found in packages/core/lib/debug/interpreter.js - About 2 days 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 index.js has 1029 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import debugModule from "debug";
      const debug = debugModule("debugger:data:sagas");
      
      import { put, takeEvery, select } from "redux-saga/effects";
      
      
      Severity: Major
      Found in packages/debugger/lib/data/sagas/index.js - About 2 days to fix

        Function variablesAndMappingsSaga has 487 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function* variablesAndMappingsSaga() {
          // stack is only ready for interpretation after the last step of each
          // source range
          //
          // the data module always looks at the result of a particular opcode
        Severity: Major
        Found in packages/debugger/lib/data/sagas/index.js - About 2 days to fix

          Function interpreter has 399 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async interpreter(cmd) {
              cmd = cmd.trim();
              let cmdArgs, splitArgs;
              debug("cmd %s", cmd);
          
          
          Severity: Major
          Found in packages/core/lib/debug/interpreter.js - About 1 day to fix

            File encoders.ts has 813 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import debugModule from "debug";
            const debug = debugModule("encoder:encoders");
            
            import { FixedNumber as EthersFixedNumber } from "@ethersproject/bignumber";
            import { getAddress } from "@ethersproject/address";
            Severity: Major
            Found in packages/encoder/lib/encoders.ts - About 1 day to fix

              Function normalize has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
              Open

                static normalize(compilations) {
                  let contexts = [];
                  let sources = {
                    user: {}, //by compilation
                    internal: {} //by context
              Severity: Minor
              Found in packages/debugger/lib/session/index.js - About 1 day 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 index.js has 738 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              const OS = require("os");
              const debug = require("debug")("debug-utils");
              const util = require("util");
              const Codec = require("@truffle/codec");
              const BN = require("bn.js");
              Severity: Major
              Found in packages/debug-utils/index.js - About 1 day to fix

                Function variablesAndMappingsSaga has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
                Open

                function* variablesAndMappingsSaga() {
                  // stack is only ready for interpretation after the last step of each
                  // source range
                  //
                  // the data module always looks at the result of a particular opcode
                Severity: Minor
                Found in packages/debugger/lib/data/sagas/index.js - About 1 day 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 printer.js has 726 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                const debugModule = require("debug");
                const debug = debugModule("lib:debug:printer");
                
                const path = require("path");
                const util = require("util");
                Severity: Major
                Found in packages/core/lib/debug/printer.js - About 1 day to fix

                  Function transactionLog has 326 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function transactionLog(state = DEFAULT_TX_LOG, action) {
                    const { pointer, newPointer, step } = action;
                    const node = state.byPointer[pointer];
                    switch (action.type) {
                      case actions.RECORD_ORIGIN:
                  Severity: Major
                  Found in packages/debugger/lib/txlog/reducers.js - About 1 day to fix

                    File interpreter.js has 698 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    const debugModule = require("debug");
                    const debug = debugModule("lib:debug:interpreter");
                    
                    const path = require("path");
                    const util = require("util");
                    Severity: Major
                    Found in packages/core/lib/debug/interpreter.js - About 1 day to fix

                      Function transactionLog has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function transactionLog(state = DEFAULT_TX_LOG, action) {
                        const { pointer, newPointer, step } = action;
                        const node = state.byPointer[pointer];
                        switch (action.type) {
                          case actions.RECORD_ORIGIN:
                      Severity: Minor
                      Found in packages/debugger/lib/txlog/reducers.js - About 1 day 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 configProps has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const configProps = ({
                        configObject
                      }: {
                        configObject: TruffleConfig;
                      }) => {
                      Severity: Minor
                      Found in packages/config/src/configDefaults.ts - About 1 day 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 content.tsx has 585 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React from "react";
                      import * as C from "../react";
                      import * as data from "./data";
                      import styles from "./styles.module.scss";
                      
                      
                      Severity: Major
                      Found in packages/codec-components/src/docs/content.tsx - About 1 day to fix

                        Function exports has 243 lines of code (exceeds 25 allowed). Consider refactoring.
                        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");
                        Severity: Major
                        Found in packages/core/lib/commands/call/run.js - About 1 day to fix

                          Function updateTransactionLogSaga has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function* updateTransactionLogSaga() {
                            const pointer = yield select(txlog.current.pointer); //log pointer, not AST pointer
                            const step = yield select(txlog.current.step);
                            if (yield select(txlog.current.isHalting)) {
                              //note that we process this case first so that it overrides the others!
                          Severity: Minor
                          Found in packages/debugger/lib/txlog/sagas/index.js - About 1 day 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 steps has 219 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            steps(kind, data) {
                              const self = this;
                              const reporter = self.reporter;
                              const valueUnit = data.valueUnit || "ETH";
                          
                          
                          Severity: Major
                          Found in packages/events/defaultSubscribers/migrate/Messages.js - About 1 day to fix

                            Function createStepSelectors has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function createStepSelectors(step, state = null) {
                              let base = {
                                /**
                                 * .trace
                                 *
                            Severity: Minor
                            Found in packages/debugger/lib/evm/selectors/index.js - About 1 day 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

                            Severity
                            Category
                            Status
                            Source
                            Language