trufflesuite/truffle

View on GitHub
packages/encoder/lib/encoders.ts

Summary

Maintainability
F
1 wk
Test Coverage

File encoders.ts has 813 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import debugModule from "debug";
const debug = debugModule("encoder:encoders");

import { FixedNumber as EthersFixedNumber } from "@ethersproject/bignumber";
import { getAddress } from "@ethersproject/address";
Severity: Major
Found in packages/encoder/lib/encoders.ts - About 1 day to fix

    Function constructor has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor(
        projectEncoder: ProjectEncoder,
        compilation: Codec.Compilations.Compilation,
        contract: Codec.Compilations.Contract,
        artifact?: Artifact
    Severity: Major
    Found in packages/encoder/lib/encoders.ts - About 2 hrs to fix

      ProjectEncoder has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class ProjectEncoder {
        private provider: Provider | null;
        private ens: any | null; //any should be ENS, sorry >_>
        private registryAddress: string | undefined = undefined;
        private ensCache: ENSCache = {};
      Severity: Minor
      Found in packages/encoder/lib/encoders.ts - About 2 hrs to fix

        Function recognizeInteger has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private recognizeInteger(input: unknown): Codec.IntegerWrapResponse {
            if (Utils.isBigNumber(input)) {
              if (input.isInteger()) {
                return {
                  kind: "integer" as const,
        Severity: Minor
        Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

          Function recognizeAddress has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private async recognizeAddress(
              input: string
            ): Promise<Codec.AddressWrapResponse> {
              let address: string | null = null;
              try {
          Severity: Minor
          Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

            Function constructor has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              constructor(info: Types.EncoderInfoInternal) {
                //first, set up the basic info that we need to run
                if (info.userDefinedTypes && info.allocations) {
                  debug("internal route!");
                  this.userDefinedTypes = info.userDefinedTypes;
            Severity: Minor
            Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

              Function forAddress has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public async forAddress(
                  address: string,
                  block: Codec.BlockSpecifier = "latest"
                ): Promise<ContractInstanceEncoder> {
                  //code duplication warning: this method is basically copypasted
              Severity: Minor
              Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

                Function recognizeInteger has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  private recognizeInteger(input: unknown): Codec.IntegerWrapResponse {
                    if (Utils.isBigNumber(input)) {
                      if (input.isInteger()) {
                        return {
                          kind: "integer" as const,
                Severity: Minor
                Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function recognizeDecimal has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private recognizeDecimal(input: unknown): Codec.DecimalWrapResponse {
                    if (Utils.isBigNumber(input)) {
                      if (input.isFinite()) {
                        return {
                          kind: "decimal" as const,
                Severity: Minor
                Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

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

                    public async init(): Promise<void> {
                      if (this.provider) {
                        debug("provider given!");
                        if (this.registryAddress !== undefined) {
                          debug("using custom registry address: %o", this.registryAddress);
                  Severity: Minor
                  Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

                    Function recognizeAddress has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private async recognizeAddress(
                        input: string
                      ): Promise<Codec.AddressWrapResponse> {
                        let address: string | null = null;
                        try {
                    Severity: Minor
                    Found in packages/encoder/lib/encoders.ts - About 55 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function constructor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      constructor(info: Types.EncoderInfoInternal) {
                        //first, set up the basic info that we need to run
                        if (info.userDefinedTypes && info.allocations) {
                          debug("internal route!");
                          this.userDefinedTypes = info.userDefinedTypes;
                    Severity: Minor
                    Found in packages/encoder/lib/encoders.ts - About 55 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function init has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public async init(): Promise<void> {
                        if (this.provider) {
                          debug("provider given!");
                          if (this.registryAddress !== undefined) {
                            debug("using custom registry address: %o", this.registryAddress);
                    Severity: Minor
                    Found in packages/encoder/lib/encoders.ts - About 55 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      constructor(
                        projectEncoder: ProjectEncoder,
                        compilation: Codec.Compilations.Compilation,
                        contract: Codec.Compilations.Contract,
                        artifact?: Artifact
                    Severity: Minor
                    Found in packages/encoder/lib/encoders.ts - About 45 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function recognizeDecimal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private recognizeDecimal(input: unknown): Codec.DecimalWrapResponse {
                        if (Utils.isBigNumber(input)) {
                          if (input.isFinite()) {
                            return {
                              kind: "decimal" as const,
                    Severity: Minor
                    Found in packages/encoder/lib/encoders.ts - About 35 mins 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

                    Avoid too many return statements within this function.
                    Open

                            return {
                              kind: "integer" as const,
                              value: null,
                              reason: nonIntegerMessage,
                              partiallyRecognized: true
                    Severity: Major
                    Found in packages/encoder/lib/encoders.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return {
                              kind: "integer" as const,
                              value: null
                            };
                      Severity: Major
                      Found in packages/encoder/lib/encoders.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return {
                                kind: "decimal" as const,
                                value: null
                              };
                        Severity: Major
                        Found in packages/encoder/lib/encoders.ts - About 30 mins to fix

                          Function forInstance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            public async forInstance(address?: string): Promise<ContractInstanceEncoder> {
                              if (address === undefined) {
                                const networkId = this.projectEncoder.getNetworkId();
                                if (networkId === null) {
                                  throw new NoNetworkError();
                          Severity: Minor
                          Found in packages/encoder/lib/encoders.ts - About 25 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function forAddress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            public async forAddress(
                              address: string,
                              block: Codec.BlockSpecifier = "latest"
                            ): Promise<ContractInstanceEncoder> {
                              //code duplication warning: this method is basically copypasted
                          Severity: Minor
                          Found in packages/encoder/lib/encoders.ts - About 25 mins 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 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

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

                            public async resolveAndWrap(
                              abisOrNameOrSig: Abi.FunctionEntry[] | string,
                              inputs: unknown[],
                              options: Types.ResolveOptions = {}
                            ): Promise<Codec.Wrap.Resolution> {
                          Severity: Major
                          Found in packages/encoder/lib/encoders.ts and 1 other location - About 2 hrs to fix
                          packages/encoder/lib/encoders.ts on lines 1283..1299

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

                          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

                            public async encodeTransaction(
                              abisOrNameOrSig: Abi.FunctionEntry[] | string,
                              inputs: unknown[],
                              options: Types.ResolveOptions = {}
                            ): Promise<Types.TxAndAbi> {
                          Severity: Major
                          Found in packages/encoder/lib/encoders.ts and 1 other location - About 2 hrs to fix
                          packages/encoder/lib/encoders.ts on lines 917..929

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

                          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

                              const data = <Uint8Array>(
                                Codec.AbiData.Encode.encodeTupleAbiWithSelector(
                                  resolution.arguments,
                                  Codec.Conversion.toBytes(resolution.method.selector),
                                  this.allocations.abi
                          Severity: Major
                          Found in packages/encoder/lib/encoders.ts and 1 other location - About 1 hr to fix
                          packages/encoder/lib/encoders.ts on lines 333..339

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

                          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

                              const data = <Uint8Array>(
                                Codec.AbiData.Encode.encodeTupleAbiWithSelector(
                                  resolution.arguments,
                                  Codec.Conversion.toBytes(resolution.method.selector),
                                  this.allocations.abi
                          Severity: Major
                          Found in packages/encoder/lib/encoders.ts and 1 other location - About 1 hr to fix
                          packages/encoder/lib/encoders.ts on lines 303..309

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

                          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

                            public async forInstance(
                              artifact: Artifact,
                              address?: string
                            ): Promise<ContractInstanceEncoder> {
                              const contractEncoder = await this.forArtifact(artifact);
                          Severity: Major
                          Found in packages/encoder/lib/encoders.ts and 1 other location - About 1 hr to fix
                          packages/decoder/lib/decoders.ts on lines 833..839

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

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                              if (bytecode && bytecode !== "0x") {
                                this.constructorContextHash = Codec.Conversion.toHexString(
                                  Codec.Evm.Utils.keccak256({
                                    type: "string",
                                    value: bytecode //has link references unresolved
                          Severity: Major
                          Found in packages/encoder/lib/encoders.ts and 1 other location - About 1 hr to fix
                          packages/encoder/lib/encoders.ts on lines 721..756

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

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                              if (deployedBytecode && deployedBytecode !== "0x") {
                                this.deployedContextHash = Codec.Conversion.toHexString(
                                  Codec.Evm.Utils.keccak256({
                                    type: "string",
                                    value: deployedBytecode //has link references unresolved
                          Severity: Major
                          Found in packages/encoder/lib/encoders.ts and 1 other location - About 1 hr to fix
                          packages/encoder/lib/encoders.ts on lines 713..720

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

                          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

                                  const inputs = allocation.arguments.map(
                                    input => ({ type: input.type, name: input.name || undefined }) //convert "" to undefined
                                  );
                          Severity: Minor
                          Found in packages/encoder/lib/encoders.ts and 1 other location - About 40 mins to fix
                          packages/encoder/lib/encoders.ts on lines 1439..1441

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

                          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

                              const inputs = allocation.arguments.map(
                                input => ({ type: input.type, name: input.name || undefined }) //convert "" to undefined
                              );
                          Severity: Minor
                          Found in packages/encoder/lib/encoders.ts and 1 other location - About 40 mins to fix
                          packages/encoder/lib/encoders.ts on lines 1404..1406

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

                          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

                            public async forContract(
                              contract: Types.ContractConstructorObject
                            ): Promise<ContractEncoder> {
                              return await this.forArtifact(contract);
                            }
                          Severity: Minor
                          Found in packages/encoder/lib/encoders.ts and 1 other location - About 40 mins to fix
                          packages/decoder/lib/decoders.ts on lines 393..397

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

                          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

                          There are no issues that match your filters.

                          Category
                          Status