trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

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

  {
    type: "codec-interface",
    name: "Format.Values.BoolValue",
    content: (
      <>
Severity: Major
Found in packages/codec-components/src/docs/content.tsx and 9 other locations - About 3 hrs to fix
packages/codec-components/src/docs/content.tsx on lines 13..24
packages/codec-components/src/docs/content.tsx on lines 127..138
packages/codec-components/src/docs/content.tsx on lines 161..172
packages/codec-components/src/docs/content.tsx on lines 245..256
packages/codec-components/src/docs/content.tsx on lines 257..268
packages/codec-components/src/docs/content.tsx on lines 291..302
packages/codec-components/src/docs/content.tsx on lines 414..425
packages/codec-components/src/docs/content.tsx on lines 436..447
packages/codec-components/src/docs/content.tsx on lines 448..459

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

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

  {
    type: "codec-interface",
    name: "Format.Values.UintValue",
    content: (
      <>
Severity: Major
Found in packages/codec-components/src/docs/content.tsx and 9 other locations - About 3 hrs to fix
packages/codec-components/src/docs/content.tsx on lines 13..24
packages/codec-components/src/docs/content.tsx on lines 127..138
packages/codec-components/src/docs/content.tsx on lines 161..172
packages/codec-components/src/docs/content.tsx on lines 245..256
packages/codec-components/src/docs/content.tsx on lines 257..268
packages/codec-components/src/docs/content.tsx on lines 291..302
packages/codec-components/src/docs/content.tsx on lines 321..332
packages/codec-components/src/docs/content.tsx on lines 414..425
packages/codec-components/src/docs/content.tsx on lines 448..459

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

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

  {
    type: "codec-interface",
    name: "Options",
    content: (
      <>
Severity: Major
Found in packages/codec-components/src/docs/content.tsx and 9 other locations - About 3 hrs to fix
packages/codec-components/src/docs/content.tsx on lines 13..24
packages/codec-components/src/docs/content.tsx on lines 127..138
packages/codec-components/src/docs/content.tsx on lines 161..172
packages/codec-components/src/docs/content.tsx on lines 245..256
packages/codec-components/src/docs/content.tsx on lines 257..268
packages/codec-components/src/docs/content.tsx on lines 291..302
packages/codec-components/src/docs/content.tsx on lines 321..332
packages/codec-components/src/docs/content.tsx on lines 414..425
packages/codec-components/src/docs/content.tsx on lines 436..447

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

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

  {
    type: "codec-interface",
    name: "ReturnDecoding",
    content: (
      <>
Severity: Major
Found in packages/codec-components/src/docs/content.tsx and 9 other locations - About 3 hrs to fix
packages/codec-components/src/docs/content.tsx on lines 13..24
packages/codec-components/src/docs/content.tsx on lines 161..172
packages/codec-components/src/docs/content.tsx on lines 245..256
packages/codec-components/src/docs/content.tsx on lines 257..268
packages/codec-components/src/docs/content.tsx on lines 291..302
packages/codec-components/src/docs/content.tsx on lines 321..332
packages/codec-components/src/docs/content.tsx on lines 414..425
packages/codec-components/src/docs/content.tsx on lines 436..447
packages/codec-components/src/docs/content.tsx on lines 448..459

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

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

  {
    type: "codec-interface",
    name: "StateVariable",
    content: (
      <>
Severity: Major
Found in packages/codec-components/src/docs/content.tsx and 9 other locations - About 3 hrs to fix
packages/codec-components/src/docs/content.tsx on lines 13..24
packages/codec-components/src/docs/content.tsx on lines 127..138
packages/codec-components/src/docs/content.tsx on lines 245..256
packages/codec-components/src/docs/content.tsx on lines 257..268
packages/codec-components/src/docs/content.tsx on lines 291..302
packages/codec-components/src/docs/content.tsx on lines 321..332
packages/codec-components/src/docs/content.tsx on lines 414..425
packages/codec-components/src/docs/content.tsx on lines 436..447
packages/codec-components/src/docs/content.tsx on lines 448..459

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

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

  {
    type: "codec-interface",
    name: "Format.Values.StructValue",
    content: (
      <>
Severity: Major
Found in packages/codec-components/src/docs/content.tsx and 9 other locations - About 3 hrs to fix
packages/codec-components/src/docs/content.tsx on lines 13..24
packages/codec-components/src/docs/content.tsx on lines 127..138
packages/codec-components/src/docs/content.tsx on lines 161..172
packages/codec-components/src/docs/content.tsx on lines 257..268
packages/codec-components/src/docs/content.tsx on lines 291..302
packages/codec-components/src/docs/content.tsx on lines 321..332
packages/codec-components/src/docs/content.tsx on lines 414..425
packages/codec-components/src/docs/content.tsx on lines 436..447
packages/codec-components/src/docs/content.tsx on lines 448..459

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

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

  {
    type: "codec-interface",
    name: "AbiArgument",
    content: (
      <>
Severity: Major
Found in packages/codec-components/src/docs/content.tsx and 9 other locations - About 3 hrs to fix
packages/codec-components/src/docs/content.tsx on lines 127..138
packages/codec-components/src/docs/content.tsx on lines 161..172
packages/codec-components/src/docs/content.tsx on lines 245..256
packages/codec-components/src/docs/content.tsx on lines 257..268
packages/codec-components/src/docs/content.tsx on lines 291..302
packages/codec-components/src/docs/content.tsx on lines 321..332
packages/codec-components/src/docs/content.tsx on lines 414..425
packages/codec-components/src/docs/content.tsx on lines 436..447
packages/codec-components/src/docs/content.tsx on lines 448..459

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

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

  {
    type: "codec-interface",
    name: "Format.Values.OptionallyNamedValue",
    content: (
      <>
Severity: Major
Found in packages/codec-components/src/docs/content.tsx and 9 other locations - About 3 hrs to fix
packages/codec-components/src/docs/content.tsx on lines 13..24
packages/codec-components/src/docs/content.tsx on lines 127..138
packages/codec-components/src/docs/content.tsx on lines 161..172
packages/codec-components/src/docs/content.tsx on lines 245..256
packages/codec-components/src/docs/content.tsx on lines 257..268
packages/codec-components/src/docs/content.tsx on lines 321..332
packages/codec-components/src/docs/content.tsx on lines 414..425
packages/codec-components/src/docs/content.tsx on lines 436..447
packages/codec-components/src/docs/content.tsx on lines 448..459

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

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

  {
    type: "codec-interface",
    name: "Format.Values.TupleValue",
    content: (
      <>
Severity: Major
Found in packages/codec-components/src/docs/content.tsx and 9 other locations - About 3 hrs to fix
packages/codec-components/src/docs/content.tsx on lines 13..24
packages/codec-components/src/docs/content.tsx on lines 127..138
packages/codec-components/src/docs/content.tsx on lines 161..172
packages/codec-components/src/docs/content.tsx on lines 245..256
packages/codec-components/src/docs/content.tsx on lines 291..302
packages/codec-components/src/docs/content.tsx on lines 321..332
packages/codec-components/src/docs/content.tsx on lines 414..425
packages/codec-components/src/docs/content.tsx on lines 436..447
packages/codec-components/src/docs/content.tsx on lines 448..459

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

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

  ({ value, name }: Codec.AbiArgument) => (
    <InjectedNode
      value={{
        ...useInjectedNode(),
        prefix: {
packages/codec-components/src/react/components/codec/format.values.optionally-named-value.tsx on lines 11..27

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

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

  {
    type: "codec-interface",
    name: "Format.Values.StringValue",
    content: (
      <>
Severity: Major
Found in packages/codec-components/src/docs/content.tsx and 9 other locations - About 3 hrs to fix
packages/codec-components/src/docs/content.tsx on lines 13..24
packages/codec-components/src/docs/content.tsx on lines 127..138
packages/codec-components/src/docs/content.tsx on lines 161..172
packages/codec-components/src/docs/content.tsx on lines 245..256
packages/codec-components/src/docs/content.tsx on lines 257..268
packages/codec-components/src/docs/content.tsx on lines 291..302
packages/codec-components/src/docs/content.tsx on lines 321..332
packages/codec-components/src/docs/content.tsx on lines 436..447
packages/codec-components/src/docs/content.tsx on lines 448..459

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

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

  ({ name, value }: Format.Values.OptionallyNamedValue) => (
    <InjectedNode
      value={{
        ...useInjectedNode(),
        prefix: {
packages/codec-components/src/react/components/codec/abi-argument.tsx on lines 11..27

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

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 DashProvider.tsx has 308 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { useReducer, useEffect, useRef, useMemo, useCallback } from "react";
import { useAccount, useNetwork } from "wagmi";
import { sha1 } from "object-hash";
import { deleteDB } from "idb/with-async-ittr";
import type { ReceivedMessageLifecycle } from "@truffle/dashboard-message-bus-client";
Severity: Minor
Found in packages/dashboard/src/contexts/DashContext/DashProvider.tsx - About 3 hrs to fix

    Function executeDeployment has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      executeDeployment(contract, args) {
        const self = this;
        return async function () {
          await self._preFlightCheck(contract);
    
    
    Severity: Major
    Found in packages/deployer/src/deployment.js - About 3 hrs to fix

      Function resolvePossibleRelations has 83 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function resolvePossibleRelations(
        relationship: "ancestor" | "descendant"
      ) {
        const { queryName, heightFilter, heightOrder } = relationshipProperties(
          relationship
      Severity: Major
      Found in packages/db/src/resources/networks/resolvePossibleRelations.ts - About 3 hrs to fix

        Function collectAllocationInfo has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function collectAllocationInfo(
          compilations: Compilations.Compilation[]
        ): ContextAndAllocationInfo {
          let contexts: Contexts.Contexts = {};
          let deployedContexts: Contexts.Contexts = {};
        Severity: Major
        Found in packages/codec/lib/abi-data/allocate/utils.ts - About 3 hrs to fix

          Function _deploy has 82 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async _deploy(
              options: Config,
              context: MigrationContext,
              deployer: DeployerInterface,
              resolver: ResolverIntercept,
          Severity: Major
          Found in packages/migrate/src/Migration.ts - About 3 hrs to fix

            Function spinners has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const spinners = Object.entries(statusByAddress).map(([address, status]) => {
                switch (status) {
                  case "querying":
                    return (
                      <Box key={`address-${address}`}>
            Severity: Major
            Found in packages/db-kit/src/cli/decodeTransaction/Splash.tsx - About 3 hrs to fix

              Function spinners has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const spinners = Object.entries(statusByAddress).map(([address, status]) => {
                  switch (status) {
                    case "querying":
                      return (
                        <Box key={`address-${address}`}>
              Severity: Major
              Found in packages/db-kit/src/cli/decodeAddress/Splash.tsx - About 3 hrs to fix

                Function decodeMappingKeyCore has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                function* decodeMappingKeyCore(indexDefinition, keyDefinition) {
                  const scopes = yield select(data.current.scopes.inlined);
                  const compilationId = yield select(data.current.compilationId);
                  const internalFor = yield select(data.current.internalSourceFor); //should be null, but...
                  const currentAssignments = yield select(data.proc.assignments);
                Severity: Minor
                Found in packages/debugger/lib/data/sagas/index.js - About 3 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

                Severity
                Category
                Status
                Source
                Language