polkadot-js/wasm

View on GitHub

Showing 27 of 37 total issues

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

export const secp256k1Compress = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
  wasm.ext_secp_pub_compress(8, ...bridge.allocU8a(pubkey));

  return bridge.resultU8a();
});
Severity: Major
Found in packages/wasm-crypto/src/bundle.ts and 8 other locations - About 1 hr to fix
packages/wasm-crypto/src/bundle.ts on lines 73..77
packages/wasm-crypto/src/bundle.ts on lines 91..95
packages/wasm-crypto/src/bundle.ts on lines 103..107
packages/wasm-crypto/src/bundle.ts on lines 139..143
packages/wasm-crypto/src/bundle.ts on lines 193..197
packages/wasm-crypto/src/bundle.ts on lines 199..203
packages/wasm-crypto/src/bundle.ts on lines 217..221
packages/wasm-crypto/src/bundle.ts on lines 223..227

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

export const sr25519KeypairFromSeed = /*#__PURE__*/ withWasm((wasm, seed: Uint8Array): Uint8Array => {
  wasm.ext_sr_from_seed(8, ...bridge.allocU8a(seed));

  return bridge.resultU8a();
});
Severity: Major
Found in packages/wasm-crypto/src/bundle.ts and 8 other locations - About 1 hr to fix
packages/wasm-crypto/src/bundle.ts on lines 73..77
packages/wasm-crypto/src/bundle.ts on lines 91..95
packages/wasm-crypto/src/bundle.ts on lines 97..101
packages/wasm-crypto/src/bundle.ts on lines 103..107
packages/wasm-crypto/src/bundle.ts on lines 193..197
packages/wasm-crypto/src/bundle.ts on lines 199..203
packages/wasm-crypto/src/bundle.ts on lines 217..221
packages/wasm-crypto/src/bundle.ts on lines 223..227

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

export const sha512 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array): Uint8Array => {
  wasm.ext_sha512(8, ...bridge.allocU8a(data));

  return bridge.resultU8a();
});
Severity: Major
Found in packages/wasm-crypto/src/bundle.ts and 8 other locations - About 1 hr to fix
packages/wasm-crypto/src/bundle.ts on lines 73..77
packages/wasm-crypto/src/bundle.ts on lines 91..95
packages/wasm-crypto/src/bundle.ts on lines 97..101
packages/wasm-crypto/src/bundle.ts on lines 103..107
packages/wasm-crypto/src/bundle.ts on lines 139..143
packages/wasm-crypto/src/bundle.ts on lines 193..197
packages/wasm-crypto/src/bundle.ts on lines 199..203
packages/wasm-crypto/src/bundle.ts on lines 217..221

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

export const ed25519KeypairFromSeed = /*#__PURE__*/ withWasm((wasm, seed: Uint8Array): Uint8Array => {
  wasm.ext_ed_from_seed(8, ...bridge.allocU8a(seed));

  return bridge.resultU8a();
});
Severity: Major
Found in packages/wasm-crypto/src/bundle.ts and 8 other locations - About 1 hr to fix
packages/wasm-crypto/src/bundle.ts on lines 91..95
packages/wasm-crypto/src/bundle.ts on lines 97..101
packages/wasm-crypto/src/bundle.ts on lines 103..107
packages/wasm-crypto/src/bundle.ts on lines 139..143
packages/wasm-crypto/src/bundle.ts on lines 193..197
packages/wasm-crypto/src/bundle.ts on lines 199..203
packages/wasm-crypto/src/bundle.ts on lines 217..221
packages/wasm-crypto/src/bundle.ts on lines 223..227

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

export const secp256k1Expand = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
  wasm.ext_secp_pub_expand(8, ...bridge.allocU8a(pubkey));

  return bridge.resultU8a();
});
Severity: Major
Found in packages/wasm-crypto/src/bundle.ts and 8 other locations - About 1 hr to fix
packages/wasm-crypto/src/bundle.ts on lines 73..77
packages/wasm-crypto/src/bundle.ts on lines 91..95
packages/wasm-crypto/src/bundle.ts on lines 97..101
packages/wasm-crypto/src/bundle.ts on lines 139..143
packages/wasm-crypto/src/bundle.ts on lines 193..197
packages/wasm-crypto/src/bundle.ts on lines 199..203
packages/wasm-crypto/src/bundle.ts on lines 217..221
packages/wasm-crypto/src/bundle.ts on lines 223..227

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

  ext_ed_sign(resLen: 8, ptrPub: number, lenPub: number, ptrSec: number, lenSec: number, ptrMsg: number, lenMsg: number): void;
Severity: Minor
Found in packages/wasm-crypto-init/src/types.ts and 1 other location - About 30 mins to fix
packages/wasm-crypto-init/src/types.ts on lines 66..66

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

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

  ext_sr_sign(resLen: 8, ptrPub: number, lenPub: number, ptrSec: number, lenSec: number, ptrMsg: number, lenMsg: number): void;
Severity: Minor
Found in packages/wasm-crypto-init/src/types.ts and 1 other location - About 30 mins to fix
packages/wasm-crypto-init/src/types.ts on lines 24..24

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

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