leap-protocol/leap-js

View on GitHub

Showing 64 of 64 total issues

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

  verify(config) {
    this._reset();

    if (config.length == 0) {
      this.section = "Config";
Severity: Minor
Found in src/configVerifier.js - 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 decode_signed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function decode_signed(item, capacity) {
  let reHex = /^[\dA-Fa-f]{1,}$/;

  if (reHex.test(item) == true) {
    let value = parseInt(item, 16);
Severity: Minor
Found in src/typeCodec.js - 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 _decode_subpacket has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  _decode_subpacket(subpacket) {
    const parts = subpacket.split(this._config["separator"]);

    if (parts != ['']) {
      const payload = [];
Severity: Minor
Found in src/codec.js - 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 verify_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  verify_type(type, branch) {
    const valid_types = ['u8', 'u16', 'u32', 'u64', 'i8', 'i16', 'i32', 'i64', 'bool', 'float', 'double', 'string', 'none'];

    if ((typeof type !== "string") && (typeof type !== "object")) {
      this.failure = `"${protocolKey.TYPE}" of "${branch}", "${type}" must be a string (or an array if (enum)`;
Severity: Minor
Found in src/configDataVerifier.js - 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

Severity
Category
Status
Source
Language