indutny/elliptic

View on GitHub
lib/elliptic/ec/index.js

Summary

Maintainability
C
7 hrs
Test Coverage

Function sign has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

EC.prototype.sign = function sign(msg, key, enc, options) {
  if (typeof enc === 'object') {
    options = enc;
    enc = null;
  }
Severity: Minor
Found in lib/elliptic/ec/index.js - About 2 hrs 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 sign has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

EC.prototype.sign = function sign(msg, key, enc, options) {
  if (typeof enc === 'object') {
    options = enc;
    enc = null;
  }
Severity: Minor
Found in lib/elliptic/ec/index.js - About 1 hr to fix

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

    EC.prototype.genKeyPair = function genKeyPair(options) {
      if (!options)
        options = {};
    
      // Instantiate Hmac_DRBG
    Severity: Minor
    Found in lib/elliptic/ec/index.js - 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

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

    EC.prototype.verify = function verify(msg, signature, key, enc) {
      msg = this._truncateToN(new BN(msg, 16));
      key = this.keyFromPublic(key, enc);
      signature = new Signature(signature, 'hex');
    
    
    Severity: Minor
    Found in lib/elliptic/ec/index.js - 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 p.eqXToP(r);
    Severity: Major
    Found in lib/elliptic/ec/index.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return false;
      Severity: Major
      Found in lib/elliptic/ec/index.js - About 30 mins to fix

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

        EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
          signature = new Signature(signature, enc);
          if (signature.recoveryParam !== null)
            return signature.recoveryParam;
        
        
        Severity: Minor
        Found in lib/elliptic/ec/index.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

        Parsing error: Invalid ecmaVersion.
        Open

        'use strict';
        Severity: Minor
        Found in lib/elliptic/ec/index.js by eslint

        For more information visit Source: http://eslint.org/docs/rules/

        There are no issues that match your filters.

        Category
        Status