lib/provider/browser.js

Summary

Maintainability
C
1 day
Test Coverage

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

  constructor() {
    function serviceUp(service) {
      logger(`serviceup: ${service.type.name}`, service);
      if (service.type.name !== "leaf") {
        logger('ignoring service, service name not leaf');
Severity: Major
Found in lib/provider/browser.js - About 2 hrs to fix

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

      constructor() {
        function serviceUp(service) {
          logger(`serviceup: ${service.type.name}`, service);
          if (service.type.name !== "leaf") {
            logger('ignoring service, service name not leaf');
    Severity: Minor
    Found in lib/provider/browser.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 get has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      get(name, ver) {
        let time = new Date();
        // think of a way to refactor this into a generator, so we can just store that as a cache and yield everytime
        // hopeful usage would be:
        // var service = cache[service@version].next();
    Severity: Minor
    Found in lib/provider/browser.js - About 1 hr to fix

      Function resolver has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            function resolver() {
              logger("looping through browser caches");
              // keep trying for a specific amount of time, now hard coded, 1s
              if (new Date() - time > 2000) {
                logger("timeout");
      Severity: Minor
      Found in lib/provider/browser.js - About 1 hr to fix

        Function serviceUp has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function serviceUp(service) {
              logger(`serviceup: ${service.type.name}`, service);
              if (service.type.name !== "leaf") {
                logger('ignoring service, service name not leaf');
                return;
        Severity: Minor
        Found in lib/provider/browser.js - About 1 hr to fix

          TODO found
          Open

                      // TODO: handle cases where it is not found
          Severity: Minor
          Found in lib/provider/browser.js by fixme

          There are no issues that match your filters.

          Category
          Status