trufflesuite/truffle

View on GitHub

Showing 685 of 1,401 total issues

Function deployed has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      deployed: () => {
        let stopText;
        if (reporter.blockSpinner) {
          reporter.blockSpinner.remove();
          stopText = `   > ${reporter.currentBlockWait}`;
Severity: Minor
Found in packages/events/defaultSubscribers/migrate/Messages.js - About 1 hr to fix

    Function sourcesWithDependencies has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async sourcesWithDependencies({ paths = [], options }) {
        options = Config.default().merge(options);
        debug("paths: %O", paths);
        const vyperFilesStrict = paths.filter(path =>
          minimatch(path, VYPER_PATTERN_STRICT, { dot: true })
    Severity: Minor
    Found in packages/compile-vyper/index.js - About 1 hr to fix

      Function compileSources has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        compileSources: async function (config, compilers) {
          compilers = config.compiler
            ? config.compiler === "none"
              ? []
              : [config.compiler]
      Severity: Minor
      Found in packages/workflow-compile/legacy/index.js - About 1 hr to fix

        Function link has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          link(name, address) {
            switch (typeof name) {
              case "string":
                // Case: Contract.link(<libraryName>, <address>)
                if (this._json.networks[this.network_id] == null) {
        Severity: Minor
        Found in packages/contract/lib/contract/constructorMethods.js - About 1 hr to fix

          Function printEvents has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            printEvents() {
              const instances = this.session.view(session.info.affectedInstances); //used to look
              const formatAddress = address => {
                const name = instances[address]?.contractName;
                const colorizedAddress = colors.yellow(address); //dull yellow
          Severity: Minor
          Found in packages/core/lib/debug/printer.js - About 1 hr to fix

            Function recognizeInteger has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private recognizeInteger(input: unknown): Codec.IntegerWrapResponse {
                if (Utils.isBigNumber(input)) {
                  if (input.isInteger()) {
                    return {
                      kind: "integer" as const,
            Severity: Minor
            Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

              Function filterProjectNetworkAncestors has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              async function filterProjectNetworkAncestors(options: {
                project: IdObject<"projects">;
                network: DataModel.ResourceNameInput;
                candidates: IdObject<"networks">[];
                workspace: Workspace;
              Severity: Minor
              Found in packages/db/src/resources/projects/resolveContractInstances.ts - About 1 hr to fix

                Function resolver has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      (sources, functions) => breakpoint => {
                        let adjustedBreakpoint;
                        if (breakpoint.node === undefined) {
                          let line = breakpoint.line;
                          if (line < 0) {
                Severity: Minor
                Found in packages/debugger/lib/controller/selectors/index.js - About 1 hr to fix

                  Function exports has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = async function (config) {
                    const debugLog = debug.extend("guard");
                    // only check if deploying on MAINNET
                    // NOTE: this includes Ethereum Classic as well as Ethereum as they're only
                    // distinguishable by checking their chainIds, 2 and 1 respectively.
                  Severity: Minor
                  Found in packages/core/lib/commands/migrate/runMigrations.js - About 1 hr to fix

                    Function recognizeAddress has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private async recognizeAddress(
                        input: string
                      ): Promise<Codec.AddressWrapResponse> {
                        let address: string | null = null;
                        try {
                    Severity: Minor
                    Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

                      Function formatCalldata has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        formatCalldata: function (calldata) {
                          //takes a Uint8Array
                          let selector = calldata.slice(0, Codec.Evm.Utils.SELECTOR_SIZE);
                          let words = [];
                          for (
                      Severity: Minor
                      Found in packages/debug-utils/index.js - About 1 hr to fix

                        Function fetchTx has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function* fetchTx(txHash, loadOptions) {
                          let result = yield* web3.inspectTransaction(txHash);
                          debug("result %o", result);
                        
                          if (result.error) {
                        Severity: Minor
                        Found in packages/debugger/lib/session/sagas/index.js - About 1 hr to fix

                          Function provision has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            provision() {
                              let files = [];
                              let jsonBlobs = [];
                              try {
                                files = fse.readdirSync(this.options.contracts_build_directory);
                          Severity: Minor
                          Found in packages/core/lib/console.js - About 1 hr to fix

                            Function withMulticallInterpretations has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              private async withMulticallInterpretations(
                                decoding: FunctionDecoding,
                                transaction: DecoderTypes.Transaction,
                                additionalContexts: Contexts.Contexts = {},
                                additionalAllocations?: {
                            Severity: Minor
                            Found in packages/decoder/lib/decoders.ts - About 1 hr to fix

                              Function connectPromise has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      (resolve, reject) => {
                                        return {
                                          open: () => {
                                            debug(
                                              "connect: %s connection succeeded to url %s",
                              Severity: Minor
                              Found in packages/dashboard-message-bus-client/lib/connection/index.ts - About 1 hr to fix

                                Function codex has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function codex(state = DEFAULT_CODEX, action) {
                                  let newState, topCodex, topCodexNoZero;
                                
                                  const updateFrameStorage = (frame, address, slot, value) => ({
                                    ...frame,
                                Severity: Minor
                                Found in packages/debugger/lib/evm/reducers.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 setUserConfigViaPrompt has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  setUserConfigViaPrompt: async function () {
                                    if (
                                      !this.getUserConfig().get("analyticsSet") &&
                                      process.stdin.isTTY === true
                                    ) {
                                Severity: Minor
                                Found in packages/core/lib/commands/config/utils.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 getCommand has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const getCommand = ({ inputStrings, options, noAliases }) => {
                                  if (inputStrings.length === 0) {
                                    return null;
                                  }
                                
                                
                                Severity: Minor
                                Found in packages/core/lib/command-utils.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 deployed has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  deployed: async function(options) {
                                    let files;
                                    try {
                                      // Only read JSON files in directory
                                      files = fs
                                Severity: Minor
                                Found in packages/core/lib/networks.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 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                async function compile(config) {
                                  // determine compiler(s) to use
                                  const compilers = config.compiler
                                    ? config.compiler === "none"
                                      ? []
                                Severity: Minor
                                Found in packages/workflow-compile/src/index.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

                                Severity
                                Category
                                Status
                                Source
                                Language