d4l3k/WebSync

View on GitHub

Showing 192 of 366 total issues

Method move has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def move dest, overwrite=false
      path = dest.path
      # Enforce a '/' at the front.
      if path[0] != "/"
        path = "/"+path
Severity: Minor
Found in lib/webdav.rb - 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

Method copy has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def copy dest, overwrite=false
      path = dest.path
      # Enforce a '/' at the front.
      if path[0] != "/"
        path = "/"+path
Severity: Minor
Found in lib/webdav.rb - 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 selectionRestore has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    selectionRestore: function(sel) {
      if (sel.active) {
        // Find all #text nodes.
        var textNodes = $('.content').find(':not(iframe)').addBack().contents().filter(function() {
          return this.nodeType === 3;
Severity: Minor
Found in assets/digest/core.js - About 1 hr to fix

    Function P has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var P = (function(prototype, ownProperty, undefined) {
      // helper functions that also help minification
      function isObject(o) { return typeof o === 'object'; }
      function isFunction(f) { return typeof f === 'function'; }
    
    
    Severity: Minor
    Found in assets/lib/mathquill.js - About 1 hr to fix

      Function v_read_delimiter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function v_read_delimiter (tokens ) {
       var v_token = tokens.list[tokens.index] ;
       if( ( v_token == null ) ) {
        throw "unexpected eof" ;
       }
      Severity: Minor
      Found in assets/lib/display-latex.user.js - About 1 hr to fix

        Function createMaterial_ has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            createMaterial_: function(materialName) {
        
                // Create material
        
                var mat = this.materialsInfo[materialName];
        Severity: Minor
        Found in assets/lib/MTL.js - About 1 hr to fix

          Function startVoice has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var startVoice = function() {
                lastResults = [];
                nodes = [];
          
                recognition = new webkitSpeechRecognition();
          Severity: Minor
          Found in assets/digest/edit.js - About 1 hr to fix

            Function v_piece_to_mathml has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            function v_piece_to_mathml (tokens ) {
             var v_token = tokens.list[tokens.index] ;
             var v_result = null ;
             if( ( v_token == "{" ) ) {
              tokens.index++;
            Severity: Minor
            Found in assets/lib/display-latex.user.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

            Method get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def get(request, response)
                  raise NotFound unless exist?
                  if collection?
                    response.body = "<html><head><style>* {font-family: monospace;} body{background-image: url(/img/logo-github.png);background-repeat:no-repeat;background-position: center center;background-attachment: fixed;}section{background-color: rgba(255,255,255,0.8)}td, th{padding-right: 5px;}th{text-align: left;}</style><body><section>"
                    response.body << "<h2>Index of #{file_path.escape_html}</h2><hr><table><thead><th>Name</th><th>Size</th><th>Last Modified</th><th>Content Type</th></thead><tbody>"
            Severity: Minor
            Found in lib/webdav.rb - 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 P has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              return function P(_superclass /* = Object */, definition) {
                // handle the case where no superclass is given
                if (definition === undefined) {
                  definition = _superclass;
                  _superclass = Object;
            Severity: Minor
            Found in assets/lib/mathquill.js - About 1 hr to fix

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

              module.exports = function(ws, data) {
                ws.responded = true;
                redis.get('doc:' + ws.docId + ':users', function(err, reply) {
                  var users = {};
                  if (reply) {
              Severity: Minor
              Found in lib/routes/ping.js - About 1 hr to fix

                Function unwrapGramp has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _.unwrapGramp = function() {
                    var gramp = this.parent.parent;
                    var greatgramp = gramp.parent;
                    var rightward = gramp[R];
                    var cursor = this;
                Severity: Minor
                Found in assets/lib/mathquill.js - About 1 hr to fix

                  Function delegateMouseEvents has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    _.delegateMouseEvents = function() {
                      var ultimateRootjQ = this.root.jQ;
                      //drag-to-select event handling
                      this.container.bind('mousedown.mathquill', function(e) {
                        var rootjQ = $(e.target).closest('.mq-root-block');
                  Severity: Minor
                  Found in assets/lib/mathquill.js - About 1 hr to fix

                    Function deleteSide has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _.deleteSide = function(side, outward, cursor) {
                        var parent = this.parent, sib = this[side], farEnd = parent.ends[side];
                    
                        if (side === this.side) { // deleting non-ghost of one-sided bracket, unwrap
                          this.unwrap();
                    Severity: Minor
                    Found in assets/lib/mathquill.js - About 1 hr to fix

                      Function data has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          jQuery.expr[':'].data = function(el, i, match) {
                      
                              matcher.lastIndex = 0;
                      
                              var expr = match[3],
                      Severity: Minor
                      Found in assets/digest/jquery.dataselector.js - About 1 hr to fix

                        Function convert has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            convert: function(materialsInfo) {
                        
                                if (!this.options) return materialsInfo;
                        
                                var converted = {};
                        Severity: Minor
                        Found in assets/lib/MTL.js - About 1 hr to fix

                          Method strip has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def self.strip(str)
                              insideString = false
                              insideComment = false
                              skipOne = false
                              ret = ''
                          Severity: Minor
                          Found in lib/strip_json_comments.rb - About 1 hr to fix

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

                                drawPoints: function(id, canvas) {
                                  var points = exports.points[id];
                                  // Find corners of the drawing
                                  var top, left, bottom, right;
                                  _.each(points, function(point) {
                            Severity: Minor
                            Found in assets/src/drawing.js - About 1 hr to fix

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

                                _.relink = function () {
                                  var allCells = this.jQ.find('td');
                                  var firstCellBlock = Node.byId[allCells.first().attr(mqBlockId)];
                                  var lastCellBlock = Node.byId[allCells.last().attr(mqBlockId)];
                                  var firstRow = allCells.eq(0).closest('tr');
                              Severity: Minor
                              Found in assets/lib/mathquill.js - About 1 hr to fix

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

                                    updateMenu: function() {
                                      $('#slideView').html('');
                                      $(exports.cssScene.children).each(function(index, slideObj) {
                                        var slide = slideObj.element;
                                        var preview = $("<div draggable='true' class='slidePreview " + ($(slide).hasClass('active') ? 'active' : '') + "'><div class='slide'>" + $(slide).html() + '</div></div>');
                                Severity: Minor
                                Found in assets/src/awesome.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language