bchelli/node-smb2

View on GitHub

Showing 16 of 24 total issues

Function exports has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(filename, data, options, cb){

  if(typeof options == 'function'){
    cb = options;
    options = {};
Severity: Major
Found in lib/api/writefile.js - About 3 hrs to fix

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

    module.exports = function(filename, options, cb){
      var connection = this;
    
      if(typeof options == 'function'){
        cb = options;
    Severity: Major
    Found in lib/api/readfile.js - About 2 hrs to fix

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

      module.exports = function(filename, data, options, cb){
      
        if(typeof options == 'function'){
          cb = options;
          options = {};
      Severity: Minor
      Found in lib/api/writefile.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 exports has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      var BigInt = module.exports = function(n, v){
      
        if(BigInt.isBigInt(n)){
      
          this.buffer = new Buffer(n.buffer.length);
      Severity: Minor
      Found in lib/tools/bigint.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 compare has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      BigInt.prototype.compare = function(v){
      
        if(!BigInt.isBigInt(v)) {
          v = BigInt.toBigInt(this.buffer.length, v);
        }
      Severity: Minor
      Found in lib/tools/bigint.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 writeFile has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function writeFile(fileWritten){
          var offset = new bigint(8)
            , stop = false
            , nbRemainingPackets = 0
            , maxPacketSize = new bigint(8, 0x00010000 - 0x71)
      Severity: Minor
      Found in lib/api/writefile.js - About 1 hr to fix

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

        BigInt.prototype.sub = function(v){
        
          if(!BigInt.isBigInt(v)) {
            v = BigInt.toBigInt(this.buffer.length, v);
          }
        Severity: Minor
        Found in lib/tools/bigint.js - About 1 hr to fix

          Function writeRequest has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function writeRequest(message, buffer, offset){
            var initOffset = offset
              , needsRewrite = false
              , tmpBuffer = new Buffer(buffer.length)
              ;
          Severity: Minor
          Found in lib/tools/smb2-message.js - About 1 hr to fix

            Function response has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            SMB2Forge.response = function(c){
              c.responses = {};
              c.responsesCB = {};
              c.responseBuffer = new Buffer(0);
              return function(response){
            Severity: Minor
            Found in lib/tools/smb2-forge.js - About 1 hr to fix

              Function parseFile has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function parseFile(buffer){
                var file = {}
                  , offset = 0
                  ;
              
              
              Severity: Minor
              Found in lib/messages/query_directory.js - About 1 hr to fix

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

                var SMB = module.exports = function(opt){
                
                  opt = opt || {};
                
                  // Parse share-string
                Severity: Minor
                Found in lib/smb2.js - About 1 hr to fix

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

                  BigInt.prototype.sub = function(v){
                  
                    if(!BigInt.isBigInt(v)) {
                      v = BigInt.toBigInt(this.buffer.length, v);
                    }
                  Severity: Minor
                  Found in lib/tools/bigint.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 exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var BigInt = module.exports = function(n, v){
                  
                    if(BigInt.isBigInt(n)){
                  
                      this.buffer = new Buffer(n.buffer.length);
                  Severity: Minor
                  Found in lib/tools/bigint.js - About 1 hr to fix

                    Function writeRequest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function writeRequest(message, buffer, offset){
                      var initOffset = offset
                        , needsRewrite = false
                        , tmpBuffer = new Buffer(buffer.length)
                        ;
                    Severity: Minor
                    Found in lib/tools/smb2-message.js - About 55 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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    BigInt.prototype.add = function(v){
                    
                      if(!BigInt.isBigInt(v)) {
                        v = BigInt.toBigInt(this.buffer.length, v);
                      }
                    Severity: Minor
                    Found in lib/tools/bigint.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 unTranslate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function unTranslate(key, value){
                      if(headerTranslates[key]){
                        for(var t in headerTranslates[key]){
                          if(headerTranslates[key][t] == value){
                            return t;
                    Severity: Minor
                    Found in lib/tools/smb2-message.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

                    Severity
                    Category
                    Status
                    Source
                    Language