trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

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

      const fragments = document.definitions
        .filter(({ kind }) => kind === "FragmentDefinition")
        .filter(
          ({ typeCondition }: graphql.FragmentDefinitionNode) =>
            typeCondition.name.value === Resource
Severity: Major
Found in packages/db/src/meta/process/resources.ts and 2 other locations - About 4 hrs to fix
packages/db/src/meta/process/resources.ts on lines 110..119
packages/db/src/meta/process/resources.ts on lines 149..158

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

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

      const fragments = document.definitions
        .filter(({ kind }) => kind === "FragmentDefinition")
        .filter(
          ({ typeCondition }: graphql.FragmentDefinitionNode) =>
            typeCondition.name.value === Resource
Severity: Major
Found in packages/db/src/meta/process/resources.ts and 2 other locations - About 4 hrs to fix
packages/db/src/meta/process/resources.ts on lines 149..158
packages/db/src/meta/process/resources.ts on lines 189..198

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

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

      const fragments = document.definitions
        .filter(({ kind }) => kind === "FragmentDefinition")
        .filter(
          ({ typeCondition }: graphql.FragmentDefinitionNode) =>
            typeCondition.name.value === Resource
Severity: Major
Found in packages/db/src/meta/process/resources.ts and 2 other locations - About 4 hrs to fix
packages/db/src/meta/process/resources.ts on lines 110..119
packages/db/src/meta/process/resources.ts on lines 189..198

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

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

  isDesignatedInvalid: function (
    instructions,
    index,
    overlapFunctions,
    node = undefined
Severity: Major
Found in packages/source-map-utils/index.js - About 4 hrs to fix

    Function reducer has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const reducer = (state: State, action: Action): State => {
      const { type, data } = action;
      switch (type) {
        case "set-decoder":
          return { ...state, ...data };
    Severity: Major
    Found in packages/dashboard/src/contexts/DashContext/state.ts - About 4 hrs to fix

      Function determineBreakpoints has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

        determineBreakpoints(args) {
          const currentLocation = this.session.view(controller.current.location);
      
          const currentStart = currentLocation.sourceRange
            ? currentLocation.sourceRange.start
      Severity: Minor
      Found in packages/core/lib/debug/interpreter.js - About 4 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

      Function typeStringWithoutLocation has 110 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function typeStringWithoutLocation(dataType: Format.Types.Type): string {
        switch (dataType.typeClass) {
          case "uint":
            return dataType.typeHint || `uint${dataType.bits}`;
          case "int":
      Severity: Major
      Found in packages/codec-components/src/utils/codec.ts - About 4 hrs to fix

        Function Contract has 109 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function Contract(contract) {
            var instance = this;
            var constructor = instance.constructor;
        
            // Disambiguate between .at() and .new()
        Severity: Major
        Found in packages/contract/lib/contract/index.js - About 4 hrs to fix

          Session has 34 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default class Session {
            /**
             * @param {Array<Compilations>} compilations
             * @param {Web3Provider} provider - web3 provider
             * txHash parameter is now optional!
          Severity: Minor
          Found in packages/debugger/lib/session/index.js - About 4 hrs to fix

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

                  networks: {
                    resolve: async (project, _, { workspace }) => {
                      debug("Resolving Project.networks...");
            
                      const nameRecords = await resolveNameRecords(
            Severity: Major
            Found in packages/db/src/resources/projects/index.ts and 1 other location - About 4 hrs to fix
            packages/db/src/resources/projects/index.ts on lines 125..147

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

            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

                  contracts: {
                    resolve: async (project, _, { workspace }) => {
                      debug("Resolving Project.contracts...");
            
                      const nameRecords = await resolveNameRecords(
            Severity: Major
            Found in packages/db/src/resources/projects/index.ts and 1 other location - About 4 hrs to fix
            packages/db/src/resources/projects/index.ts on lines 82..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 121.

            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

            File reducers.js has 342 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import debugModule from "debug";
            const debug = debugModule("debugger:evm:reducers");
            
            import { combineReducers } from "redux";
            
            
            Severity: Minor
            Found in packages/debugger/lib/evm/reducers.js - About 4 hrs to fix

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

                networks: {
                  resource: DataModel.Network;
                  input: DataModel.NetworkInput;
                  idFields: ["networkId", "historicBlock"];
                  named: true;
              Severity: Major
              Found in packages/db/src/resources/types.ts and 1 other location - About 4 hrs to fix
              packages/db/src/resources/types.ts on lines 119..132

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

              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

                projectNames: {
                  resource: DataModel.ProjectName;
                  input: DataModel.ProjectNameInput;
                  idFields: ["project", "key"];
                  mutable: true;
              Severity: Major
              Found in packages/db/src/resources/types.ts and 1 other location - About 4 hrs to fix
              packages/db/src/resources/types.ts on lines 92..105

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

              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

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

                function MantineGlobal(): JSX.Element {
                  return (
                    <Global
                      styles={theme => {
                        const { colors, colorScheme, white, fn } = theme;
                Severity: Major
                Found in packages/dashboard/src/components/MantineGlobal.tsx - About 4 hrs to fix

                  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

                          `${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

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

                      while (result.done === false) {
                        let request = result.value;
                        let response: Uint8Array;
                        switch (request.type) {
                          case "code":
                  Severity: Major
                  Found in packages/decoder/lib/decoders.ts and 2 other locations - About 4 hrs to fix
                  packages/decoder/lib/decoders.ts on lines 521..534
                  packages/decoder/lib/decoders.ts on lines 1673..1686

                  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

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

                      while (result.done === false) {
                        let request = result.value;
                        let response: Uint8Array;
                        switch (request.type) {
                          case "code":
                  Severity: Major
                  Found in packages/decoder/lib/decoders.ts and 2 other locations - About 4 hrs to fix
                  packages/decoder/lib/decoders.ts on lines 636..649
                  packages/decoder/lib/decoders.ts on lines 1673..1686

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language