BohemiaInteractive/bi-service

View on GitHub
lib/service.js

Summary

Maintainability
B
4 hrs
Test Coverage

Function listen has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Service.prototype.listen = function() {
    const self = this;

    return new Promise(function(resolve, reject) {

Severity: Minor
Found in lib/service.js - About 1 hr to fix

    Function tick has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function tick() {
                let setup = false; //whether the service is "setup" and ready
                self.once('listening', onServiceListening);
                self.once('error', onServiceError);
    
    
    Severity: Minor
    Found in lib/service.js - About 1 hr to fix

      Function $setProjectRoot has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      Service.prototype.$setProjectRoot = function(dir) {
          var p = dir || process.cwd();
      
          while ((fs.statSync(p)).isDirectory()) {
              try {
      Severity: Minor
      Found in lib/service.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 $initAppWatcher has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      Service.prototype.$initAppWatcher = function() {
          const service     = this
          let   numOfOKApps = 0;
      
          this.appManager.on('build-app', onBuildApp);
      Severity: Minor
      Found in lib/service.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