trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

Function copyFiles has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const copyFiles = async (destination, options) => {
  fse.ensureDirSync(destination);
  const { force, logger, events } = options;
  const sourcePath = path.join(__dirname, "initSource");
  const projectFiles = fse.readdirSync(sourcePath).filter(
Severity: Minor
Found in packages/core/lib/commands/init/copyFiles.js - About 1 hr to fix

    Function setAddress has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async setAddress(name, addressOrContract, { from }) {
        this.validateSetAddressInputs({ addressOrContract, name, from });
        const address = this.parseAddress(addressOrContract);
        try {
          this.setENSJS();
    Severity: Minor
    Found in packages/deployer/ens.js - About 1 hr to fix

      Function init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public async init(): Promise<void> {
          debug("initting!");
          const { provider, registryAddress } = this.ensSettings;
          if (provider) {
            debug("provider given!");
      Severity: Minor
      Found in packages/decoder/lib/decoders.ts - About 1 hr to fix

        Function setUpConfig has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          setUpConfig: config => {
            if (!config.resolver) {
              config.resolver = new Resolver(config);
            }
        
        
        Severity: Minor
        Found in packages/environment/environment.js - About 1 hr to fix

          Function getAndCacheSolcByUrl has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async getAndCacheSolcByUrl(fileName: string, index: number) {
              const { events, compilerRoots } = this.config;
              const url = `${compilerRoots![index].replace(/\/+$/, "")}/${fileName}`;
              events.emit("downloadCompiler:start", {
                attemptNumber: index + 1

            Function loadMigrate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async loadMigrate(options: {
                network: Pick<Input<"networks">, "name">;
                artifacts: (ContractObject & {
                  db: {
                    contract: IdObject<"contracts">;
            Severity: Minor
            Found in packages/db/src/project/index.ts - About 1 hr to fix

              Function require has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  require: (id: string) => {
                    // Ugh. Simulate a full require function for the file.
                    id = id.trim();
              
                    // If absolute, just require.
              Severity: Minor
              Found in packages/require/lib/index.ts - About 1 hr to fix

                Function fetchBasePath has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  compilationId,
                  internalFor,
                  baseNode,
                  currentAssignments,
                  allocations,
                Severity: Major
                Found in packages/debugger/lib/data/sagas/index.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                      if (
                        !addressOrContract ||
                        !name ||
                        !from ||
                        (typeof addressOrContract !== "string" &&
                  Severity: Major
                  Found in packages/deployer/ens.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                        if (
                          decoding.kind === "function" &&
                          decoding.abi.name === "multicall" &&
                          decoding.abi.inputs.length === 2 &&
                          decoding.abi.inputs[0].type === "uint256" &&
                    Severity: Major
                    Found in packages/decoder/lib/decoders.ts - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                          if (
                            decoding.kind === "function" &&
                            decoding.abi.name === "multicall" &&
                            decoding.abi.inputs.length === 2 &&
                            decoding.abi.inputs[0].type === "bytes32" &&
                      Severity: Major
                      Found in packages/decoder/lib/decoders.ts - About 1 hr to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          const deprecationMessage = colors.yellow(
                            `> The watch command is planned ` +
                              `for deprecation in version 6 of Truffle.${OS.EOL}` +
                              `> See https://github.com/trufflesuite/truffle/issues/3227 for more ` +
                              `information.`
                        Severity: Major
                        Found in packages/core/lib/commands/watch/run.js and 1 other location - About 1 hr to fix
                        packages/core/lib/commands/build/run.js on lines 4..9

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          const deprecationMessage = colors.yellow(
                            `> The build command is planned ` +
                              `for deprecation in version 6 of Truffle.${OS.EOL}> See ` +
                              `https://github.com/trufflesuite/truffle/issues/3226 for more ` +
                              `information.`
                        Severity: Major
                        Found in packages/core/lib/commands/build/run.js and 1 other location - About 1 hr to fix
                        packages/core/lib/commands/watch/run.js on lines 6..11

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                        function transaction(state = {}, action) {
                          switch (action.type) {
                            case actions.SAVE_TRANSACTION:
                              return action.transaction;
                            case actions.UNLOAD_TRANSACTION:
                        Severity: Major
                        Found in packages/debugger/lib/session/reducers.js and 2 other locations - About 1 hr to fix
                        packages/debugger/lib/session/reducers.js on lines 56..65
                        packages/debugger/lib/session/reducers.js on lines 67..76

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                              storageAffected: createLeaf(
                                ["./touchesStorage", state],
                        
                                (touchesStorage, { stack }) => {
                                  if (!touchesStorage) {
                        Severity: Major
                        Found in packages/debugger/lib/evm/selectors/index.js and 1 other location - About 1 hr to fix
                        packages/debugger/lib/evm/selectors/index.js on lines 218..223

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                              valueStored: createLeaf(["./isStore", state], (isStore, { stack }) => {
                                if (!isStore) {
                                  return null;
                                }
                                return stack[stack.length - 2];
                        Severity: Major
                        Found in packages/debugger/lib/evm/selectors/index.js and 1 other location - About 1 hr to fix
                        packages/debugger/lib/evm/selectors/index.js on lines 349..359

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                        function block(state = {}, action) {
                          switch (action.type) {
                            case actions.SAVE_BLOCK:
                              return action.block;
                            case actions.UNLOAD_TRANSACTION:
                        Severity: Major
                        Found in packages/debugger/lib/session/reducers.js and 2 other locations - About 1 hr to fix
                        packages/debugger/lib/session/reducers.js on lines 45..54
                        packages/debugger/lib/session/reducers.js on lines 56..65

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          stacktrace() {
                            if (!this.view(session.status.loaded)) {
                              return null;
                            }
                            return this.view(stacktrace.current.finalReport);
                        Severity: Major
                        Found in packages/debugger/lib/session/index.js and 1 other location - About 1 hr to fix
                        packages/debugger/lib/session/index.js on lines 559..564

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                  ...Object.assign(
                                    {},
                                    ...Object.entries(tx).map(([variable, value]) => ({
                                      [variable]: Codec.Conversion.toBytes(value)
                                    }))
                        Severity: Major
                        Found in packages/debugger/lib/data/selectors/index.js and 1 other location - About 1 hr to fix
                        packages/debugger/lib/data/selectors/index.js on lines 631..636

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                        function receipt(state = {}, action) {
                          switch (action.type) {
                            case actions.SAVE_RECEIPT:
                              return action.receipt;
                            case actions.UNLOAD_TRANSACTION:
                        Severity: Major
                        Found in packages/debugger/lib/session/reducers.js and 2 other locations - About 1 hr to fix
                        packages/debugger/lib/session/reducers.js on lines 45..54
                        packages/debugger/lib/session/reducers.js on lines 67..76

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language