trufflesuite/truffle

View on GitHub
packages/events/defaultSubscribers/migrate/Messages.js

Summary

Maintainability
F
5 days
Test Coverage

Function steps has 219 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  steps(kind, data) {
    const self = this;
    const reporter = self.reporter;
    const valueUnit = data.valueUnit || "ETH";

Severity: Major
Found in packages/events/defaultSubscribers/migrate/Messages.js - About 1 day to fix

    Function steps has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    File Messages.js has 341 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     *  A module that formats output for the Migrations reporter.
     */
    class Messages {
      constructor(reporter) {
    Severity: Minor
    Found in packages/events/defaultSubscribers/migrate/Messages.js - About 4 hrs to fix

      Function errors has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        errors(kind, data) {
          const prefix = " *** Deployment Failed ***\n\n";
      
          const kinds = {
            migrateErr: () =>
      Severity: Major
      Found in packages/events/defaultSubscribers/migrate/Messages.js - About 3 hrs to fix

        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

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

                  `${prefix}"${data.contract.contractName}" ran out of gas ` +
                  `(using Truffle's estimate.)\n` +
                  `   * Block limit:  ${this.decAndHex(data.blockLimit)}\n` +
                  `   * Gas sent:     ${this.decAndHex(data.estimate)}\n` +
                  `   * Try:\n` +
          Severity: Major
          Found in packages/events/defaultSubscribers/migrate/Messages.js and 1 other location - About 4 hrs to fix
          packages/events/defaultSubscribers/migrate/Messages.js on lines 116..123

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

          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

                  `${prefix}"${data.contract.contractName}" exceeded the block limit ` +
                  `(with a gas value you set).\n` +
                  `   * Block limit:  ${this.decAndHex(data.blockLimit)}\n` +
                  `   * Gas sent:     ${this.decAndHex(data.gas)}\n` +
                  `   * Try:\n` +
          Severity: Major
          Found in packages/events/defaultSubscribers/migrate/Messages.js and 1 other location - About 4 hrs to fix
          packages/events/defaultSubscribers/migrate/Messages.js on lines 68..75

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

          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 (reporter.subscriber.config.describeJson) {
                    output +=
                      self.migrationStatus({
                        status: "reusing",
                        data: {
          Severity: Major
          Found in packages/events/defaultSubscribers/migrate/Messages.js and 1 other location - About 2 hrs to fix
          packages/events/defaultSubscribers/migrate/Messages.js on lines 182..191

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

          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 (reporter.subscriber.config.describeJson) {
                    output +=
                      self.migrationStatus({
                        status: "replacing",
                        data: {
          Severity: Major
          Found in packages/events/defaultSubscribers/migrate/Messages.js and 1 other location - About 2 hrs to fix
          packages/events/defaultSubscribers/migrate/Messages.js on lines 201..210

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

          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

                  `${prefix}"${data.contract.contractName}" ` +
                  `is an abstract contract or an interface and cannot be deployed.\n` +
                  `   * Import abstractions into the '.sol' file that uses them instead of deploying them separately.\n` +
                  `   * Contracts that inherit an abstraction must implement all its method signatures exactly.\n` +
                  `   * A contract that only implements part of an inherited abstraction is also considered abstract.\n`,
          Severity: Major
          Found in packages/events/defaultSubscribers/migrate/Messages.js and 1 other location - About 1 hr to fix
          packages/events/defaultSubscribers/migrate/Messages.js on lines 81..85

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

          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

                  `${prefix}"${data.contract.contractName}" ran out of gas. Something in the constructor ` +
                  `(ex: infinite loop) caused gas estimation to fail. Try:\n` +
                  `   * Making your contract constructor more efficient\n` +
                  `   * Setting the gas manually in your config or as a deployment parameter\n` +
                  `   * Using the solc optimizer settings in 'truffle-config.js'\n` +
          Severity: Major
          Found in packages/events/defaultSubscribers/migrate/Messages.js and 1 other location - About 1 hr to fix
          packages/events/defaultSubscribers/migrate/Messages.js on lines 51..55

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

          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

                rvtNoReason: () =>
                  `${prefix}"${data.contract.contractName}" hit a require or revert statement ` +
                  `somewhere in its constructor. Try:\n` +
                  `   * Verifying that your constructor params satisfy all require conditions.\n` +
                  `   * Adding reason strings to your require statements.\n`,
          Severity: Major
          Found in packages/events/defaultSubscribers/migrate/Messages.js and 1 other location - About 1 hr to fix
          packages/events/defaultSubscribers/migrate/Messages.js on lines 100..104

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

          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

                asrtNoReason: () =>
                  `${prefix}"${data.contract.contractName}" hit an invalid opcode while deploying. Try:\n` +
                  `   * Verifying that your constructor params satisfy all assert conditions.\n` +
                  `   * Verifying your constructor code doesn't access an array out of bounds.\n` +
                  `   * Adding reason strings to your assert statements.\n`,
          Severity: Major
          Found in packages/events/defaultSubscribers/migrate/Messages.js and 1 other location - About 1 hr to fix
          packages/events/defaultSubscribers/migrate/Messages.js on lines 94..98

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

          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

          There are no issues that match your filters.

          Category
          Status