trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

Function wrapWithCases has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function* wrapWithCases<
  TypeType extends Format.Types.Type,
  ValueType,
  RequestType
>(
Severity: Minor
Found in packages/codec/lib/wrap/dispatch.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 receipt has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  receipt: async function(context, receipt) {
    // keep around the raw (not decoded) logs in the raw logs field as a
    // stopgap until we can get the ABI for all events, not just the current
    // contract
    receipt.rawLogs = receipt.logs;
Severity: Minor
Found in packages/contract/lib/handlers.js - About 1 hr to fix

    Function build has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      build: async function (options) {
        expect.options(options, [
          "build_directory",
          "working_directory",
          "contracts_build_directory",
    Severity: Minor
    Found in packages/core/lib/build.js - About 1 hr to fix

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

        Function call has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

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

            Function printStartTestHook has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              printStartTestHook(method) {
                const formatOperation = ({
                  action,
                  contract: { contractName },
                  abi,
            Severity: Minor
            Found in packages/core/lib/debug/mocha.js - About 1 hr to fix

              Function formatRangeLines has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                formatRangeLines: function (
                  source,
                  range,
                  uncolorizedSource,
                  contextBefore = 2,
              Severity: Minor
              Found in packages/debug-utils/index.js - About 1 hr to fix

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

                    } else if (decodings[0].kind === "failure") {
                      //case 5: revert (no message)
                      this.config.logger.log("");
                      this.config.logger.log("There was no revert message.");
                      this.config.logger.log("");
                Severity: Major
                Found in packages/core/lib/debug/printer.js and 3 other locations - About 1 hr to fix
                packages/core/lib/debug/printer.js on lines 470..649
                packages/core/lib/debug/printer.js on lines 481..649
                packages/core/lib/debug/printer.js on lines 501..649

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

                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 4 locations. Consider refactoring.
                Open

                    } else if (allocationFound && decodings.length === 0) {
                      //case 3: allocation found but decoding failed
                      this.config.logger.log("");
                      this.config.logger.log("The return value could not be decoded.");
                      this.config.logger.log("");
                Severity: Major
                Found in packages/core/lib/debug/printer.js and 3 other locations - About 1 hr to fix
                packages/core/lib/debug/printer.js on lines 470..649
                packages/core/lib/debug/printer.js on lines 496..649
                packages/core/lib/debug/printer.js on lines 501..649

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

                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 4 locations. Consider refactoring.
                Open

                    } else if (decodings[0].kind === "unknownbytecode") {
                      //case 6: unknown bytecode
                      this.config.logger.log("");
                      this.config.logger.log(
                        "Bytecode was returned, but it could not be identified."
                Severity: Major
                Found in packages/core/lib/debug/printer.js and 3 other locations - About 1 hr to fix
                packages/core/lib/debug/printer.js on lines 470..649
                packages/core/lib/debug/printer.js on lines 481..649
                packages/core/lib/debug/printer.js on lines 496..649

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

                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 _getMessageBusPort has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private async _getMessageBusPort(): Promise<number> {
                    if (this._connectionType === "subscribe" && this._subscribePort) {
                      return this._subscribePort;
                    }
                
                
                Severity: Minor
                Found in packages/dashboard-message-bus-client/lib/connection/index.ts - About 1 hr to fix

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

                      if (!allocationFound && decodings.length === 0) {
                        //case 1: no allocation found, decoding failed
                        this.config.logger.log("");
                        this.config.logger.log(
                          "A value was returned but it could not be decoded."
                  Severity: Major
                  Found in packages/core/lib/debug/printer.js and 3 other locations - About 1 hr to fix
                  packages/core/lib/debug/printer.js on lines 481..649
                  packages/core/lib/debug/printer.js on lines 496..649
                  packages/core/lib/debug/printer.js on lines 501..649

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

                  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

                    this.chain = this.chain.catch(function () {
                      var args = Array.prototype.slice.call(arguments);
                  
                      return fn.apply(null, args);
                    });
                  Severity: Major
                  Found in packages/deployer/src/deferredchain.js and 1 other location - About 1 hr to fix
                  packages/deployer/src/deferredchain.js on lines 17..21

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

                  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

                    this.chain = this.chain.then(function () {
                      var args = Array.prototype.slice.call(arguments);
                  
                      return fn.apply(null, args);
                    });
                  Severity: Major
                  Found in packages/deployer/src/deferredchain.js and 1 other location - About 1 hr to fix
                  packages/deployer/src/deferredchain.js on lines 31..35

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

                  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 9 locations. Consider refactoring.
                  Open

                    {
                      type: "codec-interface",
                      name: "EmptyFailureDecoding",
                      content: (
                        <>
                  Severity: Major
                  Found in packages/codec-components/src/docs/content.tsx and 8 other locations - About 1 hr to fix
                  packages/codec-components/src/docs/content.tsx on lines 117..126
                  packages/codec-components/src/docs/content.tsx on lines 139..150
                  packages/codec-components/src/docs/content.tsx on lines 151..160
                  packages/codec-components/src/docs/content.tsx on lines 281..290
                  packages/codec-components/src/docs/content.tsx on lines 369..378
                  packages/codec-components/src/docs/content.tsx on lines 379..388
                  packages/codec-components/src/docs/content.tsx on lines 404..413
                  packages/codec-components/src/docs/content.tsx on lines 426..435

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

                  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 9 locations. Consider refactoring.
                  Open

                    {
                      type: "codec-interface",
                      name: "SelfDestructDecoding",
                      content: (
                        <>
                  Severity: Major
                  Found in packages/codec-components/src/docs/content.tsx and 8 other locations - About 1 hr to fix
                  packages/codec-components/src/docs/content.tsx on lines 61..70
                  packages/codec-components/src/docs/content.tsx on lines 117..126
                  packages/codec-components/src/docs/content.tsx on lines 139..150
                  packages/codec-components/src/docs/content.tsx on lines 281..290
                  packages/codec-components/src/docs/content.tsx on lines 369..378
                  packages/codec-components/src/docs/content.tsx on lines 379..388
                  packages/codec-components/src/docs/content.tsx on lines 404..413
                  packages/codec-components/src/docs/content.tsx on lines 426..435

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

                  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 9 locations. Consider refactoring.
                  Open

                    {
                      type: "codec-interface",
                      name: "Format.Values.FixedValue",
                      content: (
                        <>
                  Severity: Major
                  Found in packages/codec-components/src/docs/content.tsx and 8 other locations - About 1 hr to fix
                  packages/codec-components/src/docs/content.tsx on lines 61..70
                  packages/codec-components/src/docs/content.tsx on lines 117..126
                  packages/codec-components/src/docs/content.tsx on lines 139..150
                  packages/codec-components/src/docs/content.tsx on lines 151..160
                  packages/codec-components/src/docs/content.tsx on lines 281..290
                  packages/codec-components/src/docs/content.tsx on lines 379..388
                  packages/codec-components/src/docs/content.tsx on lines 404..413
                  packages/codec-components/src/docs/content.tsx on lines 426..435

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

                  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 9 locations. Consider refactoring.
                  Open

                    {
                      type: "codec-interface",
                      name: "Format.Values.StringValueInfoValid",
                      content: (
                        <>
                  Severity: Major
                  Found in packages/codec-components/src/docs/content.tsx and 8 other locations - About 1 hr to fix
                  packages/codec-components/src/docs/content.tsx on lines 61..70
                  packages/codec-components/src/docs/content.tsx on lines 117..126
                  packages/codec-components/src/docs/content.tsx on lines 139..150
                  packages/codec-components/src/docs/content.tsx on lines 151..160
                  packages/codec-components/src/docs/content.tsx on lines 281..290
                  packages/codec-components/src/docs/content.tsx on lines 369..378
                  packages/codec-components/src/docs/content.tsx on lines 379..388
                  packages/codec-components/src/docs/content.tsx on lines 426..435

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

                  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 9 locations. Consider refactoring.
                  Open

                    {
                      type: "codec-interface",
                      name: "RevertMessageDecoding",
                      content: (
                        <>
                  Severity: Major
                  Found in packages/codec-components/src/docs/content.tsx and 8 other locations - About 1 hr to fix
                  packages/codec-components/src/docs/content.tsx on lines 61..70
                  packages/codec-components/src/docs/content.tsx on lines 117..126
                  packages/codec-components/src/docs/content.tsx on lines 151..160
                  packages/codec-components/src/docs/content.tsx on lines 281..290
                  packages/codec-components/src/docs/content.tsx on lines 369..378
                  packages/codec-components/src/docs/content.tsx on lines 379..388
                  packages/codec-components/src/docs/content.tsx on lines 404..413
                  packages/codec-components/src/docs/content.tsx on lines 426..435

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

                  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