trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

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

    from: {
      get() {
        try {
          return configObject.network_config.from;
        } catch (e) {
Severity: Major
Found in packages/config/src/configDefaults.ts and 6 other locations - About 1 hr to fix
packages/config/src/configDefaults.ts on lines 145..158
packages/config/src/configDefaults.ts on lines 211..224
packages/config/src/configDefaults.ts on lines 225..238
packages/config/src/configDefaults.ts on lines 239..252
packages/config/src/configDefaults.ts on lines 253..266
packages/config/src/configDefaults.ts on lines 267..280

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

    maxPriorityFeePerGas: {
      get() {
        try {
          return configObject.network_config.maxPriorityFeePerGas;
        } catch (e) {
Severity: Major
Found in packages/config/src/configDefaults.ts and 6 other locations - About 1 hr to fix
packages/config/src/configDefaults.ts on lines 145..158
packages/config/src/configDefaults.ts on lines 197..210
packages/config/src/configDefaults.ts on lines 211..224
packages/config/src/configDefaults.ts on lines 225..238
packages/config/src/configDefaults.ts on lines 239..252
packages/config/src/configDefaults.ts on lines 267..280

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

    network_id: {
      get() {
        try {
          return configObject.network_config.network_id;
        } catch (e) {
Severity: Major
Found in packages/config/src/configDefaults.ts and 6 other locations - About 1 hr to fix
packages/config/src/configDefaults.ts on lines 197..210
packages/config/src/configDefaults.ts on lines 211..224
packages/config/src/configDefaults.ts on lines 225..238
packages/config/src/configDefaults.ts on lines 239..252
packages/config/src/configDefaults.ts on lines 253..266
packages/config/src/configDefaults.ts on lines 267..280

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

    gas: {
      get() {
        try {
          return configObject.network_config.gas;
        } catch (e) {
Severity: Major
Found in packages/config/src/configDefaults.ts and 6 other locations - About 1 hr to fix
packages/config/src/configDefaults.ts on lines 145..158
packages/config/src/configDefaults.ts on lines 197..210
packages/config/src/configDefaults.ts on lines 225..238
packages/config/src/configDefaults.ts on lines 239..252
packages/config/src/configDefaults.ts on lines 253..266
packages/config/src/configDefaults.ts on lines 267..280

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

export function readTopic(
  pointer: Pointer.EventTopicPointer,
  state: Evm.EvmState
): Uint8Array {
  //not bothering with error handling on this one as I don't expect errors
Severity: Major
Found in packages/codec/lib/topic/read/index.ts and 1 other location - About 1 hr to fix
packages/codec/lib/special/read/index.ts on lines 4..10

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

    timeoutBlocks: {
      get() {
        try {
          return configObject.network_config.timeoutBlocks;
        } catch (e) {
Severity: Major
Found in packages/config/src/configDefaults.ts and 1 other location - About 1 hr to fix
packages/config/src/configDefaults.ts on lines 299..312

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

  public async getNetworkId(): Promise<number> {
    return await this.request({
      method: "net_version",
      params: [],
      formatOutput: result => parseInt(result)
Severity: Major
Found in packages/encoder/lib/adapter.ts and 1 other location - About 1 hr to fix
packages/encoder/lib/adapter.ts on lines 251..257

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

    gasPrice: {
      get() {
        try {
          return configObject.network_config.gasPrice;
        } catch (e) {
Severity: Major
Found in packages/config/src/configDefaults.ts and 6 other locations - About 1 hr to fix
packages/config/src/configDefaults.ts on lines 145..158
packages/config/src/configDefaults.ts on lines 197..210
packages/config/src/configDefaults.ts on lines 211..224
packages/config/src/configDefaults.ts on lines 239..252
packages/config/src/configDefaults.ts on lines 253..266
packages/config/src/configDefaults.ts on lines 267..280

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

    type: {
      get() {
        try {
          return configObject.network_config.type;
        } catch (e) {
Severity: Major
Found in packages/config/src/configDefaults.ts and 6 other locations - About 1 hr to fix
packages/config/src/configDefaults.ts on lines 145..158
packages/config/src/configDefaults.ts on lines 197..210
packages/config/src/configDefaults.ts on lines 211..224
packages/config/src/configDefaults.ts on lines 225..238
packages/config/src/configDefaults.ts on lines 239..252
packages/config/src/configDefaults.ts on lines 253..266

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

export function readSpecial(
  pointer: Pointer.SpecialPointer,
  state: Evm.EvmState
): Uint8Array {
  //not bothering with error handling on this one as I don't expect errors
Severity: Major
Found in packages/codec/lib/special/read/index.ts and 1 other location - About 1 hr to fix
packages/codec/lib/topic/read/index.ts on lines 4..10

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

    confirmations: {
      get() {
        try {
          return configObject.network_config.confirmations;
        } catch (e) {
Severity: Major
Found in packages/config/src/configDefaults.ts and 1 other location - About 1 hr to fix
packages/config/src/configDefaults.ts on lines 327..340

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

  public async getBlockNumber(): Promise<number> {
    return await this.request({
      method: "eth_blockNumber",
      params: [],
      formatOutput: result => parseInt(result)
Severity: Major
Found in packages/encoder/lib/adapter.ts and 1 other location - About 1 hr to fix
packages/encoder/lib/adapter.ts on lines 243..249

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 (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

Function handleEnter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function* handleEnter(sourceId, sourceIndex, node, pointer, parentId) {
  debug("entering %s %s", sourceId, pointer);

  if (!(node instanceof Object)) {
    return;
Severity: Minor
Found in packages/debugger/lib/ast/sagas/index.js - About 1 hr to fix

    Function revertString has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          rawRevertMessage => {
            let revertDecodings = Codec.decodeRevert(
              Codec.Conversion.toBytes(rawRevertMessage)
            );
            if (
    Severity: Minor
    Found in packages/debugger/lib/stacktrace/selectors/index.js - About 1 hr to fix

      Function decodeLogs has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        decodeLogs(_logs, isSingle) {
          const constructor = this;
          const logs = Utils.toTruffleLog(_logs, isSingle);
      
          return logs
      Severity: Minor
      Found in packages/contract/lib/utils/index.js - About 1 hr to fix

        Function allEvents has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          allEvents: function (web3Instance) {
            const constructor = this;
            const decode = utils.decodeLogs;
            let currentLogID = null;
        
        
        Severity: Minor
        Found in packages/contract/lib/execute.js - About 1 hr to fix

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

            async start() {
              try {
                // start the repl with an empty prompt and show a proper one when
                // the repl has set up its context and is ready to accept input
                this.repl = repl.start({
          Severity: Minor
          Found in packages/core/lib/console.js - About 1 hr to fix

            Function sendTransactionManual has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function sendTransactionManual(web3, params, promiEvent) {
              debug("executing manually!");
              //set up ethers provider
              const ethersProvider = new ethers.providers.Web3Provider(
                web3.currentProvider
            Severity: Minor
            Found in packages/contract/lib/manual-send.js - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language