trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

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

  private async interpretTryAggregate(
    decoding: Codec.CalldataDecoding,
    transaction: DecoderTypes.Transaction,
    additionalContexts: Contexts.Contexts = {},
    additionalAllocations?: {
Severity: Major
Found in packages/decoder/lib/decoders.ts and 4 other locations - About 2 hrs to fix
packages/decoder/lib/decoders.ts on lines 998..1034
packages/decoder/lib/decoders.ts on lines 1060..1159
packages/decoder/lib/decoders.ts on lines 1282..1324
packages/decoder/lib/decoders.ts on lines 1326..1368

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

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

  private async interpretDeadlinedMulticall(
    decoding: Codec.CalldataDecoding,
    transaction: DecoderTypes.Transaction,
    additionalContexts: Contexts.Contexts = {},
    additionalAllocations?: {
Severity: Major
Found in packages/decoder/lib/decoders.ts and 4 other locations - About 2 hrs to fix
packages/decoder/lib/decoders.ts on lines 998..1034
packages/decoder/lib/decoders.ts on lines 1060..1159
packages/decoder/lib/decoders.ts on lines 1230..1280
packages/decoder/lib/decoders.ts on lines 1326..1368

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

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

  private async interpretBlockhashedMulticall(
    decoding: Codec.CalldataDecoding,
    transaction: DecoderTypes.Transaction,
    additionalContexts: Contexts.Contexts = {},
    additionalAllocations?: {
Severity: Major
Found in packages/decoder/lib/decoders.ts and 4 other locations - About 2 hrs to fix
packages/decoder/lib/decoders.ts on lines 998..1034
packages/decoder/lib/decoders.ts on lines 1060..1159
packages/decoder/lib/decoders.ts on lines 1230..1280
packages/decoder/lib/decoders.ts on lines 1282..1324

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

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

export const { OverlargePointersNotImplementedError } = createCodecComponent(
  "OverlargePointersNotImplementedError",
  ({
    kind,
    pointerAsBN
packages/codec-components/src/react/components/codec/format.errors.bool-out-of-range-error.tsx on lines 6..11
packages/codec-components/src/react/components/codec/format.errors.overlong-array-or-string-strict-mode-error.tsx on lines 6..14
packages/codec-components/src/react/components/codec/format.errors.overlong-arrays-and-strings-not-implemented-error.tsx on lines 6..15

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

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

export const { OverlongArrayOrStringStrictModeError } = createCodecComponent(
  "OverlongArrayOrStringStrictModeError",
  ({
    kind,
    lengthAsBN
packages/codec-components/src/react/components/codec/format.errors.bool-out-of-range-error.tsx on lines 6..11
packages/codec-components/src/react/components/codec/format.errors.overlarge-pointers-not-implemented-error.tsx on lines 6..14
packages/codec-components/src/react/components/codec/format.errors.overlong-arrays-and-strings-not-implemented-error.tsx on lines 6..15

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

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

export const { BoolOutOfRangeError } = createCodecComponent(
  "BoolOutOfRangeError",
  ({ kind, rawAsBN }: Format.Errors.BoolOutOfRangeError) => (
    <CodecError kind={kind}>{rawAsBN.toString()}</CodecError>
  )
packages/codec-components/src/react/components/codec/format.errors.overlarge-pointers-not-implemented-error.tsx on lines 6..14
packages/codec-components/src/react/components/codec/format.errors.overlong-array-or-string-strict-mode-error.tsx on lines 6..14
packages/codec-components/src/react/components/codec/format.errors.overlong-arrays-and-strings-not-implemented-error.tsx on lines 6..15

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

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

export const { OverlongArraysAndStringsNotImplementedError } =
  createCodecComponent(
    "OverlongArraysAndStringsNotImplementedError",
    ({
      kind,
packages/codec-components/src/react/components/codec/format.errors.bool-out-of-range-error.tsx on lines 6..11
packages/codec-components/src/react/components/codec/format.errors.overlarge-pointers-not-implemented-error.tsx on lines 6..14
packages/codec-components/src/react/components/codec/format.errors.overlong-array-or-string-strict-mode-error.tsx on lines 6..14

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

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 webpack.config.js has 254 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const webpack = require("webpack");
const pkg = require("./package.json");
Severity: Minor
Found in packages/truffle/webpack.config.js - About 2 hrs to fix

    Function callstackAndCodexSaga has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    export function* callstackAndCodexSaga() {
      if (yield select(evm.current.step.isExceptionalHalting)) {
        //let's handle this case first so we can be sure everything else is *not*
        //an exceptional halt
        debug("exceptional halt!");
    Severity: Minor
    Found in packages/debugger/lib/evm/sagas/index.js - About 2 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 exports has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = async function (config) {
      const debugLog = debug.extend("guard");
      // only check if deploying on MAINNET
      // NOTE: this includes Ethereum Classic as well as Ethereum as they're only
      // distinguishable by checking their chainIds, 2 and 1 respectively.
    Severity: Minor
    Found in packages/core/lib/commands/migrate/runMigrations.js - About 2 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 exports has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = async function (options) {
      const OS = require("os");
      const { promisify } = require("util");
      const loadConfig = require("../../loadConfig");
      const { Environment } = require("@truffle/environment");
    Severity: Minor
    Found in packages/core/lib/commands/debug/run.js - About 2 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 collectAllocationInfo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    export function collectAllocationInfo(
      compilations: Compilations.Compilation[]
    ): ContextAndAllocationInfo {
      let contexts: Contexts.Contexts = {};
      let deployedContexts: Contexts.Contexts = {};
    Severity: Minor
    Found in packages/codec/lib/abi-data/allocate/utils.ts - About 2 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 repairOldContracts has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function repairOldContracts(contracts: Contracts): Contracts {
      const contractNames = Object.values(contracts)
        .map(source => Object.keys(source))
        .flat();
      if (contractNames.some(name => name.includes(":"))) {
    Severity: Minor
    Found in packages/compile-solidity/src/run.ts - About 2 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 _deploy has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      async _deploy(
        options: Config,
        context: MigrationContext,
        deployer: DeployerInterface,
        resolver: ResolverIntercept,
    Severity: Minor
    Found in packages/migrate/src/Migration.ts - About 2 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 Stack has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function Stack(): JSX.Element | null {
      const { classes } = useStyles();
      const {
        state: {
          debugger: { session }
    Severity: Minor
    Found in packages/dashboard/src/components/composed/Debugger/Stack.tsx - About 2 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 callstackAndCodexSaga has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function* callstackAndCodexSaga() {
      if (yield select(evm.current.step.isExceptionalHalting)) {
        //let's handle this case first so we can be sure everything else is *not*
        //an exceptional halt
        debug("exceptional halt!");
    Severity: Major
    Found in packages/debugger/lib/evm/sagas/index.js - About 2 hrs to fix

      Function testConnection has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        testConnection: function (options) {
          let networkCheckTimeout, networkType;
          const { networks, network } = options;
          if (networks && networks[network]) {
            networkCheckTimeout =
      Severity: Major
      Found in packages/provider/index.js - About 2 hrs to fix

        Function getUserDefinedGlobals has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getUserDefinedGlobals({ accounts, interfaceAdapter, web3 }) {
            // exit if feature should be disabled
            if (this.options["require-none"]) return;
        
            // exit if no hydrate options are set
        Severity: Major
        Found in packages/core/lib/console.js - About 2 hrs to fix

          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

          Severity
          Category
          Status
          Source
          Language