From 8e48e54922680fdde43adf53bc0fe4fc3169b75d Mon Sep 17 00:00:00 2001 From: DCoded <dcoded@live.com> Date: Tue, 9 Apr 2019 23:57:30 -0400 Subject: [PATCH] Whitespace changes, updated sanityCheck --- sanityCheck.sh | 4 ++++ src/endWeek/saRest.js | 6 +++--- src/js/utilJS.js | 4 ++-- src/js/wombJS.js | 6 +++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/sanityCheck.sh b/sanityCheck.sh index a9b91931493..e78439d5781 100755 --- a/sanityCheck.sh +++ b/sanityCheck.sh @@ -121,6 +121,10 @@ $GREP -E "@@(\.|,|;|:)\s" -- src/*.tw | myprint "WrongSelectorPunctuation" $GREP "@@[a-z]\+;" -- 'src/*' | myprint "SelectorMissingDot" # Check for </span>. instead of .</span> $GREP -E "</span>(\.|,|;|:)\s" -- src/*.js | myprint "WrongSelectorPunctuation" +# Check for missing whitespace between operators +#$GREP -E "\(.(\+|\-|\*|\/|\=)." -- src/*.js --exclude={dTree,dTree.min,format,Jquery,mousetrap}.js | myprint "MissingWhitespace" // can't quite get this to work +# Check for @@ selector instead of <span> selector +$GREP -E "@@\." -- src/*.js | myprint "WrongSelectorUsed" # Check that we do not have any variables that we use only once. e.g. $onlyUsedOnce # Ignore *Nationalities diff --git a/src/endWeek/saRest.js b/src/endWeek/saRest.js index cd32de24646..771b3e49ea2 100644 --- a/src/endWeek/saRest.js +++ b/src/endWeek/saRest.js @@ -92,7 +92,7 @@ window.saRest = /** @param {App.Entity.SlaveState} slave */ function saRest(slav } else { t += `an incident without lasting effect.`; } - slave.devotion += (1*_vignette.effect); + slave.devotion += (1 * _vignette.effect); } else if (_vignette.type === "trust") { if (_vignette.effect > 0) { if (slave.trust > 20) { @@ -113,7 +113,7 @@ window.saRest = /** @param {App.Entity.SlaveState} slave */ function saRest(slav } else { t += `an incident without lasting effect.`; } - slave.trust += (1*_vignette.effect); + slave.trust += (1 * _vignette.effect); } else if (_vignette.type === "health") { if (_vignette.effect > 0) { t += `<span class='green'>improving ${his} health.</span>`; @@ -122,7 +122,7 @@ window.saRest = /** @param {App.Entity.SlaveState} slave */ function saRest(slav } else { t += `an incident without lasting effect.`; } - slave.health += (2*_vignette.effect); + slave.health += (2 * _vignette.effect); } else { if (_vignette.effect > 0) { t += `<span class='green'>gaining you a bit of reputation.</span>`; diff --git a/src/js/utilJS.js b/src/js/utilJS.js index f525e80cd24..d9991029781 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -815,7 +815,7 @@ window.generateNewID = function generateNewID() { let uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { let r = (date + Math.random()*16)%16 | 0; date = Math.floor(date/16); - return (c==="x" ? r : (r & 0x3 | 0x8)).toString(16); + return (c ==="x" ? r : (r & 0x3 | 0x8)).toString(16); }); return uuid; }; @@ -943,7 +943,7 @@ window.dickToInchString = function(s) { // takes a dick value e.g. $activeSlave.dick, returns an int of the dick length in cm window.dickToCM = function(s) { - return (s<9?s*5:(s===9?50:s*6)); + return (s < 9 ? s * 5 : (s === 9 ? 50 : s * 6)); // TODO: use if blocks instead of nested ternary operators for readibility? }; // takes a ball value e.g. $activeSlave.balls, returns a string in the format 3 inches diff --git a/src/js/wombJS.js b/src/js/wombJS.js index 5ebbf4ea90e..2fb2c454e27 100644 --- a/src/js/wombJS.js +++ b/src/js/wombJS.js @@ -83,7 +83,7 @@ window.WombInit = function(actor) { window.WombImpregnate = function(actor, fCount, fatherID, age, surrogate) { let i; let tf; - for (i=0; i<fCount; i++) { + for (i = 0; i < fCount; i++) { tf = {}; // new Object tf.age = age; // initial age tf.realAge = 1; // initial real age (first week in mother) @@ -128,7 +128,7 @@ window.WombSurrogate = function (actor, fCount, mother, fatherID, age) { window.WombImpregnateClone = function(actor, fCount, mother, motherOriginal, age) { let i; let tf; - for (i=0; i<fCount; i++) { + for (i = 0; i < fCount; i++) { tf = {}; // new Object tf.age = age; // initial age tf.realAge = 1; // initial real age (first week in mother) @@ -216,7 +216,7 @@ window.WombBirth = function (actor, readyAge) { let ready = WombBirthReady(actor, readyAge); let i; - for (i=0; i<ready; i++) { // here can't be used "for .. in .." syntax. + for ( i = 0; i < ready; i++) { // here can't be used "for .. in .." syntax. birthed.push(actor.womb.shift()); } -- GitLab