azukiapp/azk

View on GitHub
src/utils/net.js

Summary

Maintainability
C
1 day
Test Coverage

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

  waitService(uri, opts = {}) {
    opts = _.defaults(opts, {
      timeout: 10000,      // maximum timeout - this may be override
      retry_if: () => { return promiseResolve(true); },
      publish_retry: true,
Severity: Major
Found in src/utils/net.js - About 2 hrs to fix

    File net.js has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { _, fs, lazy_require, config, set_config } from 'azk';
    import { publish } from 'azk/utils/postal';
    import { async, defer, ninvoke, promiseResolve } from 'azk/utils/promises';
    import { envDefaultArray, isBlank } from 'azk/utils';
    
    
    Severity: Minor
    Found in src/utils/net.js - About 2 hrs to fix

      Function nameServers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        nameServers(custom_dns_servers, options={}) {
          var dns_servers;
          var nameservers     = config(cache_key);
          var env_dns_servers = envDefaultArray('AZK_DNS_SERVERS', []);
      
      
      Severity: Minor
      Found in src/utils/net.js - About 1 hr 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 waitForwardingService has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        waitForwardingService(host, port, retry = 15, timeout = 10000) {
          return defer((resolve, reject) => {
            var client   = null;
            var attempts = 1, max = retry;
            var connect  = () => {
      Severity: Minor
      Found in src/utils/net.js - About 1 hr to fix

        Function nameServers has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          nameServers(custom_dns_servers, options={}) {
            var dns_servers;
            var nameservers     = config(cache_key);
            var env_dns_servers = envDefaultArray('AZK_DNS_SERVERS', []);
        
        
        Severity: Minor
        Found in src/utils/net.js - About 1 hr to fix

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

            waitService(uri, opts = {}) {
              opts = _.defaults(opts, {
                timeout: 10000,      // maximum timeout - this may be override
                retry_if: () => { return promiseResolve(true); },
                publish_retry: true,
          Severity: Minor
          Found in src/utils/net.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

          There are no issues that match your filters.

          Category
          Status