trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

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

export const { BytesStaticValue } = createCodecComponent(
  "BytesStaticValue",
  ({ value, type }: Format.Values.BytesStaticValue) => {
    const { prefix, content } = useInjectedNode();
    return (
packages/codec-components/src/react/components/codec/format.values.address-value.tsx on lines 8..20
packages/codec-components/src/react/components/codec/format.values.bytes-dynamic-value.tsx on lines 8..20
packages/codec-components/src/react/components/codec/format.values.enum-value.tsx on lines 8..20

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

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

  determineBreakpoints(args) {
    const currentLocation = this.session.view(controller.current.location);

    const currentStart = currentLocation.sourceRange
      ? currentLocation.sourceRange.start
Severity: Major
Found in packages/core/lib/debug/interpreter.js - About 5 hrs to fix

    Function init has 126 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public async init(): Promise<void> {
        this.contractCode = Conversion.toHexString(
          await this.getCode(
            this.contractAddress,
            await this.providerAdapter.getBlockNumber() //not "latest" because regularized
    Severity: Major
    Found in packages/decoder/lib/decoders.ts - About 5 hrs to fix

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

        sectionHeader: {
          height: 42,
          fontSize: 16,
          paddingTop: 10,
          paddingLeft: 16,
      packages/dashboard/src/components/composed/Debugger/Stack.tsx on lines 6..20
      packages/dashboard/src/components/composed/Debugger/Variables.tsx on lines 8..22

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

      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

        sectionHeader: {
          height: 42,
          fontSize: 16,
          paddingTop: 10,
          paddingLeft: 16,
      packages/dashboard/src/components/composed/Debugger/Breakpoints/index.tsx on lines 21..35
      packages/dashboard/src/components/composed/Debugger/Stack.tsx on lines 6..20

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

      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

        sectionHeader: {
          height: 42,
          fontSize: 16,
          paddingTop: 10,
          paddingLeft: 16,
      packages/dashboard/src/components/composed/Debugger/Breakpoints/index.tsx on lines 21..35
      packages/dashboard/src/components/composed/Debugger/Variables.tsx on lines 8..22

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

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

        async connect(): Promise<void> {
          if (this._socket) {
            switch (this._socket.readyState) {
              case WebSocket.CONNECTING:
                debug(
      Severity: Major
      Found in packages/dashboard-message-bus-client/lib/connection/index.ts - About 4 hrs to fix

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

              fc
                .tuple(
                  fc.oneof(fc.constant("nonpayable"), fc.constant("payable")),
                  fc.boolean(),
                  fc.boolean()
        Severity: Major
        Found in packages/abi-utils/lib/arbitrary.ts and 1 other location - About 4 hrs to fix
        packages/abi-utils/lib/arbitrary.ts on lines 122..139

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

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

              fc
                .tuple(
                  fc.oneof(fc.constant("nonpayable"), fc.constant("payable")),
                  fc.boolean(),
                  fc.boolean()
        Severity: Major
        Found in packages/abi-utils/lib/arbitrary.ts and 1 other location - About 4 hrs to fix
        packages/abi-utils/lib/arbitrary.ts on lines 156..173

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

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

        export async function requiredSources({
          allPaths,
          updatedPaths,
          resolve,
          shouldIncludePath,
        Severity: Minor
        Found in packages/profiler/src/requiredSources.ts - 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

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

          while (!result.done) {
            debug("request received");
            let request = result.value;
            let response;
            switch (request.type) {
        Severity: Major
        Found in packages/debugger/lib/data/sagas/index.js and 2 other locations - About 4 hrs to fix
        packages/debugger/lib/data/sagas/index.js on lines 1187..1203
        packages/debugger/lib/data/sagas/index.js on lines 1241..1257

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

        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) {
            debug("request received");
            let request = result.value;
            let response;
            switch (request.type) {
        Severity: Major
        Found in packages/debugger/lib/data/sagas/index.js and 2 other locations - About 4 hrs to fix
        packages/debugger/lib/data/sagas/index.js on lines 1120..1136
        packages/debugger/lib/data/sagas/index.js on lines 1241..1257

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

        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) {
            debug("request received");
            let request = result.value;
            let response;
            switch (request.type) {
        Severity: Major
        Found in packages/debugger/lib/data/sagas/index.js and 2 other locations - About 4 hrs to fix
        packages/debugger/lib/data/sagas/index.js on lines 1120..1136
        packages/debugger/lib/data/sagas/index.js on lines 1187..1203

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

        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

          return (
            <Box flexDirection="column">
              {showLoaders && (
                <Box
                  key="loaders"
        Severity: Major
        Found in packages/db-kit/src/cli/decodeTransaction/Splash.tsx and 1 other location - About 4 hrs to fix
        packages/db-kit/src/cli/decodeAddress/Splash.tsx on lines 132..153

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

        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

          return (
            <Box flexDirection="column">
              {showLoaders && (
                <Box
                  key="loaders"
        Severity: Major
        Found in packages/db-kit/src/cli/decodeAddress/Splash.tsx and 1 other location - About 4 hrs to fix
        packages/db-kit/src/cli/decodeTransaction/Splash.tsx on lines 137..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 130.

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

        const utils = require("../utils");
        const web3Utils = require("web3-utils");
        
        module.exports = {
          contract_name: {
        Severity: Minor
        Found in packages/contract/lib/contract/properties.js - About 4 hrs to fix

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

            export type Batch<C extends Config> = {
              structure: Structure<C>;
              breadcrumb: Breadcrumb<C>;
          
              input: Contract<C>;
          Severity: Major
          Found in packages/db/src/project/loadCompile/batch.ts and 1 other location - About 4 hrs to fix
          packages/db/src/project/loadCompile/batch.ts on lines 42..53

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

          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 type Batch<C extends Config> = {
              structure: Structure<C>;
              breadcrumb: Breadcrumb<C>;
          
              input: Compilation<C>;
          Severity: Major
          Found in packages/db/src/project/loadCompile/batch.ts and 1 other location - About 4 hrs to fix
          packages/db/src/project/loadCompile/batch.ts on lines 117..126

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

          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

          ProjectDecoder has 35 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class ProjectDecoder {
            private providerAdapter: ProviderAdapter;
          
            private compilations: Compilations.Compilation[];
            private contexts: Contexts.Contexts = {}; //all contexts
          Severity: Minor
          Found in packages/decoder/lib/decoders.ts - About 4 hrs to fix

            Function decodeMagic has 112 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function* decodeMagic(
              dataType: Format.Types.MagicType,
              pointer: Pointer.SpecialPointer,
              info: Evm.EvmInfo
            ): Generator<DecoderRequest, Format.Values.MagicResult, Uint8Array | null> {
            Severity: Major
            Found in packages/codec/lib/special/decode/index.ts - About 4 hrs to fix
              Severity
              Category
              Status
              Source
              Language