igor-alexandrov/wiselinks

View on GitHub
lib/assets/javascripts/lib/native.history.js

Summary

Maintainability
F
4 mos
Test Coverage

Function initCore has 855 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    History.initCore = function(options){
        // Initialise
        if ( typeof History.initCore.initialized !== 'undefined' ) {
            // Already Loaded
            return false;
Severity: Major
Found in lib/assets/javascripts/lib/native.history.js - About 4 days to fix

    File native.history.js has 1413 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
        json2.js
        2012-10-08
    
        Public Domain.
    Severity: Major
    Found in lib/assets/javascripts/lib/native.history.js - About 3 days to fix

      Function initHtml4 has 261 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          History.initHtml4 = function(){
              // Initialise
              if ( typeof History.initHtml4.initialized !== 'undefined' ) {
                  // Already Loaded
                  return false;
      Severity: Major
      Found in lib/assets/javascripts/lib/native.history.js - About 1 day to fix

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

            function str(key, holder) {
        
        // Produce a string from holder[key].
        
                var i,          // The loop counter.
        Severity: Major
        Found in lib/assets/javascripts/lib/native.history.js - About 2 hrs to fix

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

                      History.hashChangeInit = function(){
                          // Define our Checker Function
                          History.checkerFunction = null;
          
                          // Define some variables that will help in our checker function
          Severity: Major
          Found in lib/assets/javascripts/lib/native.history.js - About 2 hrs to fix

            Function onUnload has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        History.onUnload = function(){
                            // Prepare
                            var    currentStore, item, currentStoreString;
            
                            // Fetch
            Severity: Minor
            Found in lib/assets/javascripts/lib/native.history.js - About 1 hr to fix

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

                      History.log = function(){
                          // Prepare
                          var
                              consoleExists = !(typeof console === 'undefined' || typeof console.log === 'undefined' || typeof console.log.apply === 'undefined'),
                              textarea = document.getElementById('log'),
              Severity: Minor
              Found in lib/assets/javascripts/lib/native.history.js - About 1 hr to fix

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

                            History.onPopState = function(event,extra){
                                // Prepare
                                var stateId = false, newState = false, currentHash, currentState;
                
                                // Reset the double check
                Severity: Minor
                Found in lib/assets/javascripts/lib/native.history.js - About 1 hr to fix

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

                              History.pushState = function(data,title,url,queue){
                                  //History.debug('History.pushState: 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 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 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

                          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 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

                                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 lib/assets/javascripts/lib/native.history.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 lib/assets/javascripts/lib/native.history.js - About 45 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                        return true;
                                        Severity: Major
                                        Found in lib/assets/javascripts/lib/native.history.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                      return doc.URL || doc.location.href;
                                          Severity: Major
                                          Found in lib/assets/javascripts/lib/native.history.js - About 30 mins to fix

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                            (function(window,undefined){
                                                "use strict";
                                            
                                                // ========================================================================
                                                // Initialise
                                            Severity: Major
                                            Found in lib/assets/javascripts/lib/native.history.js and 1 other location - About 2 mos to fix
                                            build/wiselinks-1.2.2.js on lines 1973..4011

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 10961.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                            (function(window,undefined){
                                                "use strict";
                                            
                                                // ========================================================================
                                                // Initialise
                                            Severity: Major
                                            Found in lib/assets/javascripts/lib/native.history.js and 1 other location - About 2 wks to fix
                                            build/wiselinks-1.2.2.js on lines 1289..1965

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 3225.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                            (function () {
                                                'use strict';
                                            
                                                function f(n) {
                                                    // Format integers to have at least two digits.
                                            Severity: Major
                                            Found in lib/assets/javascripts/lib/native.history.js and 1 other location - About 1 wk to fix
                                            build/wiselinks-1.2.2.js on lines 840..1160

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 1837.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                            (function(window,undefined){
                                                "use strict";
                                            
                                                // Localise Globals
                                                var History = window.History = window.History||{};
                                            Severity: Major
                                            Found in lib/assets/javascripts/lib/native.history.js and 1 other location - About 4 days to fix
                                            build/wiselinks-1.2.2.js on lines 1168..1280

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 715.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            There are no issues that match your filters.

                                            Category
                                            Status