trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

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

    try {
      return {
        compile: options =>
          String(execSync(command, { input: options, maxBuffer })),
        version: () => versionString
packages/compile-solidity/src/compilerSupplier/loadingStrategies/Native.ts on lines 11..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 79.

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 Mutation<
  C extends Collections,
  M extends MutationName<C> = MutationName<C>
> = {
  [K in M]: K extends keyof CollectionMutation<C>
Severity: Major
Found in packages/db/src/meta/process/types.ts and 1 other location - About 2 hrs to fix
packages/db/src/meta/process/types.ts on lines 151..156

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

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 Query<
  C extends Collections,
  Q extends QueryName<C> = QueryName<C>
> = {
  [K in Q]: K extends keyof CollectionQuery<C> ? CollectionQuery<C>[K] : never;
Severity: Major
Found in packages/db/src/meta/process/types.ts and 1 other location - About 2 hrs to fix
packages/db/src/meta/process/types.ts on lines 176..183

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

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 adapter.ts has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import debugModule from "debug";
const debug = debugModule("decoder:adapter");
import type { BlockSpecifier } from "@truffle/codec";
import type BN from "bn.js";
import type {
Severity: Minor
Found in packages/encoder/lib/adapter.ts - About 2 hrs to fix

    File VersionRange.ts has 257 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import debugModule from "debug";
    const debug = debugModule("compile:compilerSupplier");
    
    import requireFromString from "require-from-string";
    
    

      Function _ has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                    ...Object.entries(scopes).map(([id, scope]) => {
                      let definition = inlined[id].definition;
                      if (definition.nodeType === "ContractDefinition") {
                        //contract definition case: process inheritance
                        debug("contract id %d", id);
      Severity: Major
      Found in packages/debugger/lib/data/selectors/index.js - About 2 hrs to fix

        Function start has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          start: async function (context, web3Error) {
            const constructor = this;
            let currentBlock = override.defaultMaxBlocks;
        
            // Reject after attempting to get reason string if we shouldn't be waiting.
        Severity: Major
        Found in packages/contract/lib/override.js - About 2 hrs to fix

          Function link has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            link: async function (library, destinations, deployer) {
              let eventArgs;
              let libraryName = library.contractName;
              if (libraryName == null && library.constructor) {
                //allow for the possibility that library is an instance rather
          Severity: Major
          Found in packages/deployer/src/linker.js - About 2 hrs to fix

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

            module.exports = async options => {
              const { Develop } = require("@truffle/environment");
              const Config = require("@truffle/config");
            
              const config = Config.detect(options);
            Severity: Major
            Found in packages/core/lib/commands/develop/run.js - About 2 hrs to fix

              Function decodeVariable has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private async decodeVariable(
                  variable: Storage.Allocate.StateVariableAllocation,
                  block: RegularizedBlockSpecifier
                ): Promise<DecoderTypes.StateVariable> {
                  const info: Codec.Evm.EvmInfo = {
              Severity: Major
              Found in packages/decoder/lib/decoders.ts - About 2 hrs to fix

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

                        <C.Container
                          prefix={<mark style={{ backgroundColor: "cyan" }}>prefix</mark>}
                          suffix={<mark style={{ backgroundColor: "magenta" }}>suffix</mark>}
                          empty={false}
                        >
                Severity: Major
                Found in packages/codec-components/src/docs/content.tsx and 2 other locations - About 2 hrs to fix
                packages/codec-components/src/docs/content.tsx on lines 500..506
                packages/codec-components/src/docs/content.tsx on lines 508..523

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

                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

                        <C.Container
                          prefix={<mark style={{ backgroundColor: "cyan" }}>prefix</mark>}
                          suffix={<mark style={{ backgroundColor: "magenta" }}>suffix</mark>}
                          empty={false}
                        >
                Severity: Major
                Found in packages/codec-components/src/docs/content.tsx and 2 other locations - About 2 hrs to fix
                packages/codec-components/src/docs/content.tsx on lines 508..523
                packages/codec-components/src/docs/content.tsx on lines 525..547

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

                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

                        <C.Container
                          prefix={<mark style={{ backgroundColor: "cyan" }}>prefix</mark>}
                          suffix={<mark style={{ backgroundColor: "magenta" }}>suffix</mark>}
                          empty={false}
                        >
                Severity: Major
                Found in packages/codec-components/src/docs/content.tsx and 2 other locations - About 2 hrs to fix
                packages/codec-components/src/docs/content.tsx on lines 500..506
                packages/codec-components/src/docs/content.tsx on lines 525..547

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

                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

                  public async wrap(
                    dataType: Codec.Format.Types.Type,
                    input: unknown
                  ): Promise<Codec.Format.Values.Value> {
                    return await this.projectEncoder.wrap(dataType, input);
                Severity: Major
                Found in packages/encoder/lib/encoders.ts and 3 other locations - About 2 hrs to fix
                packages/encoder/lib/encoders.ts on lines 762..767
                packages/encoder/lib/encoders.ts on lines 1485..1490
                packages/encoder/lib/encoders.ts on lines 1495..1500

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

                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

                  public async wrapElementaryValue(
                    dataType: Codec.Format.Types.ElementaryType,
                    input: unknown
                  ): Promise<Codec.Format.Values.ElementaryValue> {
                    return await this.contractEncoder.wrapElementaryValue(dataType, input);
                Severity: Major
                Found in packages/encoder/lib/encoders.ts and 3 other locations - About 2 hrs to fix
                packages/encoder/lib/encoders.ts on lines 762..767
                packages/encoder/lib/encoders.ts on lines 772..777
                packages/encoder/lib/encoders.ts on lines 1495..1500

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

                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

                  public async wrapElementaryValue(
                    dataType: Codec.Format.Types.ElementaryType,
                    input: unknown
                  ): Promise<Codec.Format.Values.ElementaryValue> {
                    return await this.projectEncoder.wrapElementaryValue(dataType, input);
                Severity: Major
                Found in packages/encoder/lib/encoders.ts and 3 other locations - About 2 hrs to fix
                packages/encoder/lib/encoders.ts on lines 772..777
                packages/encoder/lib/encoders.ts on lines 1485..1490
                packages/encoder/lib/encoders.ts on lines 1495..1500

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

                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

                  public async wrap(
                    dataType: Codec.Format.Types.Type,
                    input: unknown
                  ): Promise<Codec.Format.Values.Value> {
                    return await this.contractEncoder.wrap(dataType, input);
                Severity: Major
                Found in packages/encoder/lib/encoders.ts and 3 other locations - About 2 hrs to fix
                packages/encoder/lib/encoders.ts on lines 762..767
                packages/encoder/lib/encoders.ts on lines 772..777
                packages/encoder/lib/encoders.ts on lines 1485..1490

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

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

                export function* process(options: {
                  networks: (Pick<Resource<"networks">, "id" | "historicBlock"> | undefined)[];
                  settings?: {
                    disableIndex?: boolean;
                  };
                Severity: Major
                Found in packages/db/src/network/load/networkGenealogies.ts - About 2 hrs to fix

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

                    private async interpretAggregate(
                      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 1230..1280
                  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 interpretMulticall(
                      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 1060..1159
                  packages/decoder/lib/decoders.ts on lines 1230..1280
                  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

                  Severity
                  Category
                  Status
                  Source
                  Language