igor-alexandrov/wiselinks

View on GitHub

Showing 46 of 73 total issues

Function parse has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        JSON.parse = function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.

Severity: Minor
Found in lib/assets/javascripts/lib/native.history.js - About 1 hr to fix

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

                History.onHashChange = function(event){
                    //History.debug('History.onHashChange', arguments);
    
                    // Prepare
                    var currentUrl = ((event && event.newURL) || History.getLocationHref()),
    Severity: Minor
    Found in build/wiselinks-1.2.2.js - About 1 hr to fix

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

                  History.onHashChange = function(event){
                      //History.debug('History.onHashChange', arguments);
      
                      // Prepare
                      var currentUrl = ((event && event.newURL) || History.getLocationHref()),
      Severity: Minor
      Found in lib/assets/javascripts/lib/native.history.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                if (History.options.html4Mode) {
                    History.emulated = {
                        pushState : true,
                        hashChange: true
                    };
        Severity: Critical
        Found in lib/assets/javascripts/lib/native.history.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if (History.options.html4Mode) {
                      History.emulated = {
                          pushState : true,
                          hashChange: true
                      };
          Severity: Critical
          Found in build/wiselinks-1.2.2.js - About 1 hr to fix

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

                        History.replaceState = function(data,title,url,queue){
                            //History.debug('History.replaceState: called', arguments);
            
                            // We assume that the URL passed in is URI-encoded, but this makes
                            // sure that it's fully URI encoded; any '%'s that are encoded are
            Severity: Minor
            Found in build/wiselinks-1.2.2.js - About 1 hr to fix

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

                          History.replaceState = function(data,title,url,queue){
                              //History.debug('History.replaceState: called', arguments);
              
                              // We assume that the URL passed in is URI-encoded, but this makes
                              // sure that it's fully URI encoded; any '%'s that are encoded are
              Severity: Minor
              Found in lib/assets/javascripts/lib/native.history.js - About 1 hr to fix

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

                    DOMParser.prototype._parser_factory = function() {
                      var create_document_using_DOM, create_document_using_parser, create_document_using_write, e, testDoc, _ref;
                      create_document_using_parser = function(html) {
                        return (new DOMParser).parseFromString(html, 'text/html');
                      };
                Severity: Minor
                Found in build/wiselinks-1.2.2.js - About 1 hr to fix

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

                          History.normalizeState = function(oldState){
                              // Variables
                              var newState, dataNotEmpty;
                  
                              // Prepare
                  Severity: Minor
                  Found in build/wiselinks-1.2.2.js - About 1 hr to fix

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

                            History.normalizeState = function(oldState){
                                // Variables
                                var newState, dataNotEmpty;
                    
                                // Prepare
                    Severity: Minor
                    Found in lib/assets/javascripts/lib/native.history.js - About 1 hr to fix

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

                                          History.checkerFunction = function(){
                                              // Check Running
                                              if ( checkerRunning ) {
                                                  return false;
                                              }
                      Severity: Minor
                      Found in lib/assets/javascripts/lib/native.history.js - About 1 hr to fix

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

                                            History.checkerFunction = function(){
                                                // Check Running
                                                if ( checkerRunning ) {
                                                    return false;
                                                }
                        Severity: Minor
                        Found in build/wiselinks-1.2.2.js - About 1 hr to fix

                          Method render_with_wiselinks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def render_with_wiselinks(*args, &block)
                                options = _normalize_args(*args)
                          
                                if self.request.wiselinks?
                                  self.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
                          Severity: Minor
                          Found in lib/wiselinks/rendering.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

                          Avoid deeply nested control flow statements.
                          Open

                                                      if (v !== undefined) {
                                                          value[k] = v;
                                                      } else {
                                                          delete value[k];
                                                      }
                          Severity: Major
                          Found in build/wiselinks-1.2.2.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                        if (startedWithHash && iframeHash === '') {
                                                            History.back();
                                                        }
                                                        else {
                                                            // Update the Hash
                            Severity: Major
                            Found in build/wiselinks-1.2.2.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if (v) {
                                                          partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                                      }
                              Severity: Major
                              Found in lib/assets/javascripts/lib/native.history.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                            if (v !== undefined) {
                                                                value[k] = v;
                                                            } else {
                                                                delete value[k];
                                                            }
                                Severity: Major
                                Found in lib/assets/javascripts/lib/native.history.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if (v) {
                                                              partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                                          }
                                  Severity: Major
                                  Found in build/wiselinks-1.2.2.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if (v) {
                                                                partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                                            }
                                    Severity: Major
                                    Found in lib/assets/javascripts/lib/native.history.js - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if (v) {
                                                                  partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                                              }
                                      Severity: Major
                                      Found in build/wiselinks-1.2.2.js - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language