meteor/meteor

View on GitHub
packages/mongo/oplog_tailing.js

Summary

Maintainability
C
1 day
Test Coverage

Function _maybeStartWorker has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _maybeStartWorker: function () {
    var self = this;
    if (self._workerActive) return;
    self._workerActive = true;

Severity: Major
Found in packages/mongo/oplog_tailing.js - About 2 hrs to fix

    File oplog_tailing.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var Future = Npm.require('fibers/future');
    
    import { NpmModuleMongodb } from "meteor/npm-mongo";
    const { Long } = NpmModuleMongodb;
    
    
    Severity: Minor
    Found in packages/mongo/oplog_tailing.js - About 2 hrs to fix

      Function _startTailing has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _startTailing: function () {
          var self = this;
          // First, make sure that we're talking to the local database.
          var mongodbUri = Npm.require('mongodb-uri');
          if (mongodbUri.parse(self._oplogUrl).database !== 'local') {
      Severity: Major
      Found in packages/mongo/oplog_tailing.js - About 2 hrs to fix

        Function handleDoc has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              function handleDoc(doc) {
                if (doc.ns === "admin.$cmd") {
                  if (doc.o.applyOps) {
                    // This was a successful transaction, so we need to apply the
                    // operations that were involved.
        Severity: Minor
        Found in packages/mongo/oplog_tailing.js - About 1 hr to fix

          Function waitUntilCaughtUp has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            waitUntilCaughtUp: function () {
              var self = this;
              if (self._stopped)
                throw new Error("Called waitUntilCaughtUp on stopped handle!");
          
          
          Severity: Minor
          Found in packages/mongo/oplog_tailing.js - About 1 hr to fix

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

              waitUntilCaughtUp: function () {
                var self = this;
                if (self._stopped)
                  throw new Error("Called waitUntilCaughtUp on stopped handle!");
            
            
            Severity: Minor
            Found in packages/mongo/oplog_tailing.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 _startTailing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              _startTailing: function () {
                var self = this;
                // First, make sure that we're talking to the local database.
                var mongodbUri = Npm.require('mongodb-uri');
                if (mongodbUri.parse(self._oplogUrl).database !== 'local') {
            Severity: Minor
            Found in packages/mongo/oplog_tailing.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