trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

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

  update<M extends MutableCollectionName<C>>(
    collectionName: M,
    input: MutationInput<C, M>
  ): Promise<MutationPayload<C, M>>;
Severity: Major
Found in packages/db/src/meta/data.ts and 1 other location - About 1 hr to fix
packages/db/src/meta/data.ts on lines 31..34

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 62.

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

Function getFlattedEvents has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      const getFlattedEvents = (node, address, codeAddress, status) => {
        switch (node.type) {
          case "transaction":
            return node.actions.flatMap(subNode =>
              getFlattedEvents(subNode, node.origin, node.origin, status)
Severity: Minor
Found in packages/debugger/lib/txlog/selectors/index.js - About 1 hr to fix

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

    module.exports = async function (options) {
      const Config = require("@truffle/config");
      const WorkflowCompile = require("@truffle/workflow-compile").default;
      const ConfigurationError = require("../../errors/configurationerror");
      const exec = require("@truffle/require").exec;
    Severity: Minor
    Found in packages/core/lib/commands/exec/run.js - About 1 hr to fix

      Function getGasEstimate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        getGasEstimate: function (params, blockLimit, stacktrace = false) {
          const constructor = this;
          const interfaceAdapter = constructor.interfaceAdapter;
          const web3 = constructor.web3;
      
      
      Severity: Minor
      Found in packages/contract/lib/execute.js - About 1 hr to fix

        Function clean has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          clean: async function(config) {
            // Only read JSON files in directory
            let files = fs
              .readdirSync(config.contracts_build_directory)
              .filter(fn => fn.endsWith(".json"));
        Severity: Minor
        Found in packages/core/lib/networks.js - About 1 hr to fix

          Function formatHelp has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            formatHelp: function (lastCommand = "n") {
              var prefix = [
                "Commands:",
                truffleColors.mint("(enter)") +
                  " last command entered (" +
          Severity: Minor
          Found in packages/debug-utils/index.js - About 1 hr to fix

            Function compile has 33 lines of code (exceeds 25 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

              Function typeDefs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                get typeDefs(): graphql.DocumentNode[] {
                  const log = debug.extend("typeDefs");
                  log("Generating...");
              
                  const common = gql`
              Severity: Minor
              Found in packages/db/src/meta/graph/schema.ts - About 1 hr to fix

                Function CodecComponentsProvider has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function CodecComponentsProvider(
                  props: CodecComponentsProviderProps
                ): JSX.Element {
                  const classNamePrefix = useClassNamePrefix();
                  const containerDepth = useContainerDepth();

                  Function process has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function* process(options: {
                    earliest: Resource<"networks"> | undefined;
                    latest: Resource<"networks"> | undefined;
                  }): Process<Resource<"networks">[]> {
                    if (!options.latest) {
                  Severity: Minor
                  Found in packages/db/src/network/query/ancestorsBetween.ts - About 1 hr to fix

                    Function ConnectedContent has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function ConnectedContent(): JSX.Element {
                      const { address } = useAccount();
                      const {
                        state: { chainInfo }
                      } = useDash()!;

                      Function startServers has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function startServers() {
                        notice("Press ^C or Q to exit\nStarting servers...");
                      
                        const { commands, result } = concurrently(
                          [
                      Severity: Minor
                      Found in packages/dashboard/dev-server/all.ts - About 1 hr to fix

                        Function processResult has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private static processResult(
                            result: EtherscanResult
                          ): Types.SourceInfo | null {
                            //we have 5 cases here.
                            //case 1: the address doesn't exist
                        Severity: Minor
                        Found in packages/source-fetcher/lib/etherscan.ts - About 1 hr to fix

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

                              if (locations.has("sto")) {
                                this.config.logger.log(DebugUtils.formatStorage(storage));
                                this.config.logger.log("");
                              }
                          Severity: Major
                          Found in packages/core/lib/debug/printer.js and 1 other location - About 1 hr to fix
                          packages/core/lib/debug/printer.js on lines 247..250

                          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 61.

                          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

                              if (locations.has("cal")) {
                                this.config.logger.log(DebugUtils.formatCalldata(calldata));
                                this.config.logger.log("");
                              }
                          Severity: Major
                          Found in packages/core/lib/debug/printer.js and 1 other location - About 1 hr to fix
                          packages/core/lib/debug/printer.js on lines 243..246

                          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 61.

                          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

                          export interface FunctionExternalValue {
                            type: Types.FunctionExternalType;
                            kind: "value";
                            value: FunctionExternalValueInfo;
                            interpretations: {
                          Severity: Major
                          Found in packages/codec/lib/format/values.ts and 1 other location - About 1 hr to fix
                          packages/codec/lib/format/elementary.ts on lines 251..258

                          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 61.

                          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

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

                                const calls = await Promise.all(
                                  decodedArray.value.map(
                                    async callResult =>
                                      await this.interpretCallInMulti(
                                        callResult as Format.Values.BytesResult,
                          Severity: Major
                          Found in packages/decoder/lib/decoders.ts and 1 other location - About 1 hr to fix
                          packages/decoder/lib/decoders.ts on lines 1308..1319

                          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 61.

                          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

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

                            artifact: {
                              db: {
                                contract: IdObject<"contracts">;
                                callBytecode: IdObject<"bytecodes">;
                                createBytecode: IdObject<"bytecodes">;
                          Severity: Major
                          Found in packages/db/src/project/loadMigrate/contractInstances.ts and 1 other location - About 1 hr to fix
                          packages/db/src/project/loadMigrate/contracts.ts on lines 14..20

                          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 61.

                          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

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

                                const calls = await Promise.all(
                                  decodedArray.value.map(
                                    async callResult =>
                                      await this.interpretCallInMulti(
                                        callResult as Format.Values.BytesResult,
                          Severity: Major
                          Found in packages/decoder/lib/decoders.ts and 1 other location - About 1 hr to fix
                          packages/decoder/lib/decoders.ts on lines 1352..1363

                          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 61.

                          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

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

                            artifact: {
                              db: {
                                contract: IdObject<"contracts">;
                                callBytecode: IdObject<"bytecodes">;
                                createBytecode: IdObject<"bytecodes">;
                          Severity: Major
                          Found in packages/db/src/project/loadMigrate/contracts.ts and 1 other location - About 1 hr to fix
                          packages/db/src/project/loadMigrate/contractInstances.ts on lines 13..19

                          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 61.

                          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