assets/js/jquery.history.js
Function historyCheck
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
Open
historyCheck: function () {
// if ((xoops_smallworld.browser.msie) && (xoops_smallworld.browser.version < 8)) {
if (xoops_smallworld.browser.msie) {
// On IE, check for location.hash of iframe
var ihistory = xoops_smallworld("#xoops_smallworld_history")[0];
- Read upRead up
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 historyCheck
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
historyCheck: function () {
// if ((xoops_smallworld.browser.msie) && (xoops_smallworld.browser.version < 8)) {
if (xoops_smallworld.browser.msie) {
// On IE, check for location.hash of iframe
var ihistory = xoops_smallworld("#xoops_smallworld_history")[0];
Function historyLoad
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
historyLoad: function (hash) {
var newhash;
hash = decodeURIComponent(hash.replace(/\?.*$/, ''));
if (xoops_smallworld.browser.safari) {
Function historyInit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
historyInit: function (callback, src) {
xoops_smallworld.historyCallback = callback;
if (src) xoops_smallworld.historyIframeSrc = src;
var current_hash = location.hash.replace(/\?.*$/, '');
Function historyInit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
historyInit: function (callback, src) {
xoops_smallworld.historyCallback = callback;
if (src) xoops_smallworld.historyIframeSrc = src;
var current_hash = location.hash.replace(/\?.*$/, '');
- Read upRead up
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
Open
if (cachedHash != undefined) {
xoops_smallworld.historyCurrentHash = location.hash.replace(/\?.*$/, '');
xoops_smallworld.historyCallback(cachedHash);
}
Avoid deeply nested control flow statements. Open
Open
if (historyDelta < 0) { // back button has been pushed
// move items to forward stack
for (var i = 0; i < Math.abs(historyDelta); i++) xoops_smallworld.historyForwardStack.unshift(xoops_smallworld.historyBackStack.pop());
} else { // forward button has been pushed
// move items to back stack
Avoid deeply nested control flow statements. Open
Open
} else if (xoops_smallworld.historyBackStack[xoops_smallworld.historyBackStack.length - 1] == undefined && !xoops_smallworld.isFirst) {
// back button has been pushed to beginning and URL already pointed to hash (e.g. a bookmark)
// document.URL doesn't change in Safari
if (location.hash) {
var current_hash = location.hash;