trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

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

export const { ElementaryErrorResult } = createCodecComponent(
  "ElementaryErrorResult",
  (data: Format.Errors.ElementaryErrorResult) =>
    isUintErrorResult(data) ? (
      <UintErrorResult data={data} />
packages/codec-components/src/react/components/codec/format.errors.abi-error-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.abi-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.abi-value.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.elementary-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.elementary-value.tsx on lines 28..54

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

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

export const { AbiValue } = createCodecComponent(
  "AbiValue",
  (data: Format.Values.AbiValue) =>
    isUintValue(data) ? (
      <UintValue data={data} />
packages/codec-components/src/react/components/codec/format.errors.abi-error-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.errors.elementary-error-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.abi-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.elementary-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.elementary-value.tsx on lines 28..54

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

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

export const { ElementaryResult } = createCodecComponent(
  "ElementaryResult",
  (data: Format.Values.ElementaryResult) =>
    isUintResult(data) ? (
      <UintResult data={data} />
packages/codec-components/src/react/components/codec/format.errors.abi-error-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.errors.elementary-error-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.abi-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.abi-value.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.elementary-value.tsx on lines 28..54

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

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

export const { AbiResult } = createCodecComponent(
  "AbiResult",
  (data: Format.Values.AbiResult) =>
    isUintResult(data) ? (
      <UintResult data={data} />
packages/codec-components/src/react/components/codec/format.errors.abi-error-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.errors.elementary-error-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.abi-value.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.elementary-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.elementary-value.tsx on lines 28..54

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

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

export const { AbiErrorResult } = createCodecComponent(
  "AbiErrorResult",
  (data: Format.Errors.AbiErrorResult) =>
    isUintErrorResult(data) ? (
      <UintErrorResult data={data} />
packages/codec-components/src/react/components/codec/format.errors.elementary-error-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.abi-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.abi-value.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.elementary-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.elementary-value.tsx on lines 28..54

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

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

export const { ElementaryValue } = createCodecComponent(
  "ElementaryValue",
  (data: Format.Values.ElementaryValue) =>
    isUintValue(data) ? (
      <UintValue data={data} />
packages/codec-components/src/react/components/codec/format.errors.abi-error-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.errors.elementary-error-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.abi-result.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.abi-value.tsx on lines 28..54
packages/codec-components/src/react/components/codec/format.values.elementary-result.tsx on lines 28..54

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

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

export const { Value } = createCodecComponent(
  "Value",
  (data: Format.Values.Value) =>
    isElementaryValue(data) ? (
      <ElementaryValue data={data} />
packages/codec-components/src/react/components/codec/format.errors.error-result.tsx on lines 26..50
packages/codec-components/src/react/components/codec/format.values.result.tsx on lines 26..50

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

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

export const { ErrorResult } = createCodecComponent(
  "ErrorResult",
  (data: Format.Errors.ErrorResult) =>
    isElementaryErrorResult(data) ? (
      <ElementaryErrorResult data={data} />
packages/codec-components/src/react/components/codec/format.values.result.tsx on lines 26..50
packages/codec-components/src/react/components/codec/format.values.value.tsx on lines 26..50

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

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

export const { Result } = createCodecComponent(
  "Result",
  (data: Format.Values.Result) =>
    isElementaryResult(data) ? (
      <ElementaryResult data={data} />
packages/codec-components/src/react/components/codec/format.errors.error-result.tsx on lines 26..50
packages/codec-components/src/react/components/codec/format.values.value.tsx on lines 26..50

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

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

export const { TypeValueEnum } = createCodecComponent(
  "TypeValueEnum",
  ({ type, value }: Format.Values.TypeValueEnum) => (
    <Container
      prefix={
packages/codec-components/src/react/components/codec/format.values.type-value-contract.tsx on lines 9..34

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

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

export const { TypeValueContract } = createCodecComponent(
  "TypeValueContract",
  ({ type, value }: Format.Values.TypeValueContract) => (
    <Container
      prefix={
packages/codec-components/src/react/components/codec/format.values.type-value-enum.tsx on lines 9..34

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

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 configProps has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

export const configProps = ({
  configObject
}: {
  configObject: TruffleConfig;
}) => {
Severity: Minor
Found in packages/config/src/configDefaults.ts - About 1 day 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 content.tsx has 585 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from "react";
import * as C from "../react";
import * as data from "./data";
import styles from "./styles.module.scss";

Severity: Major
Found in packages/codec-components/src/docs/content.tsx - About 1 day to fix

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

    module.exports = async function (options) {
      const debug = require("debug")("core:commands:call");
      const fs = require("fs");
      const util = require("util");
      const { Environment } = require("@truffle/environment");
    Severity: Major
    Found in packages/core/lib/commands/call/run.js - About 1 day to fix

      Function updateTransactionLogSaga has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
      Open

      function* updateTransactionLogSaga() {
        const pointer = yield select(txlog.current.pointer); //log pointer, not AST pointer
        const step = yield select(txlog.current.step);
        if (yield select(txlog.current.isHalting)) {
          //note that we process this case first so that it overrides the others!
      Severity: Minor
      Found in packages/debugger/lib/txlog/sagas/index.js - About 1 day 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

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

      class ImmutableDefinitionSchema<
        C extends Collections,
        N extends CollectionName<C>
      > extends DefinitionSchema<C, N> {
        get resolvers() {
      Severity: Major
      Found in packages/db/src/meta/graph/schema.ts and 1 other location - About 1 day to fix
      packages/db/src/meta/graph/schema.ts on lines 322..352

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

      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

      class MutableDefinitionSchema<
        C extends Collections,
        M extends MutableCollectionName<C>
      > extends DefinitionSchema<C, M> {
        get resolvers() {
      Severity: Major
      Found in packages/db/src/meta/graph/schema.ts and 1 other location - About 1 day to fix
      packages/db/src/meta/graph/schema.ts on lines 290..320

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

      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 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 createStepSelectors has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
        Open

        function createStepSelectors(step, state = null) {
          let base = {
            /**
             * .trace
             *
        Severity: Minor
        Found in packages/debugger/lib/evm/selectors/index.js - About 1 day 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

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

        export const { EventDecoding } = createCodecComponent(
          "EventDecoding",
          (data: Codec.EventDecoding) => {
            return (
              <Container
        packages/codec-components/src/react/components/codec/constructor-decoding.tsx on lines 9..30
        packages/codec-components/src/react/components/codec/revert-message-decoding.tsx on lines 9..30

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

        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