{"results":{"result":{"added-files":{"code-health":8.566783617149571,"old-code-health":0.0,"files":[{"file":"src/mips/tests/cdrom/cester-hw.c","loc":229,"code-health":8.479163401604131},{"file":"tests/pcsxrunner/cdrom.cc","loc":14,"code-health":10.0}]},"external-review-url":"https://github.com/grumpycoders/pcsx-redux/pull/1129","old-code-health":6.1527040902026995,"modified-files":{"code-health":6.0286228369409605,"old-code-health":6.1527040902026995,"files":[{"file":"src/core/cdrom.cc","loc":1058,"old-loc":1265,"code-health":7.359405497726427,"old-code-health":8.19972246462558},{"file":"src/core/r3000a.cc","loc":434,"old-loc":451,"code-health":6.843007089719543,"old-code-health":6.787647825907914},{"file":"src/core/sstate.cc","loc":340,"old-loc":388,"code-health":9.521952216628808,"old-code-health":9.245306373181874},{"file":"src/gui/gui.cc","loc":2569,"old-loc":2573,"code-health":1.9592073850418203,"old-code-health":1.9592073850418203},{"file":"src/gui/widgets/isobrowser.cc","loc":138,"old-loc":138,"code-health":8.77219002921793,"old-code-health":8.77219002921793},{"file":"src/main/main.cc","loc":364,"old-loc":364,"code-health":7.835591080031977,"old-code-health":7.835591080031977},{"file":"src/core/gte.cc","loc":885,"old-loc":885,"code-health":7.474791419624982,"old-code-health":7.474791419624982},{"file":"src/core/psxinterpreter.cc","loc":1359,"old-loc":1358,"code-health":7.106711345609554,"old-code-health":7.106711345609554},{"file":"src/core/luaiso.cc","loc":94,"old-loc":83,"code-health":10.0,"old-code-health":10.0},{"file":"third_party/cueparser/cueparser.c","loc":689,"old-loc":686,"code-health":5.310444246999639,"old-code-health":5.337887084790794},{"file":"src/cdrom/cdriso-cue.cc","loc":155,"old-loc":155,"code-health":8.501875942088805,"old-code-health":8.501875942088805},{"file":"src/cdrom/cdriso.cc","loc":432,"old-loc":390,"code-health":6.593450594526128,"old-code-health":6.794181428903033},{"file":"src/core/DynaRec_aa64/recompiler.cc","loc":289,"old-loc":287,"code-health":9.007512075550654,"old-code-health":9.017682320203175},{"file":"src/core/DynaRec_x64/recompiler.cc","loc":469,"old-loc":466,"code-health":6.688517230339398,"old-code-health":6.699358046557445},{"file":"src/gui/widgets/log.cc","loc":153,"old-loc":151,"code-health":7.882021622588315,"old-code-health":7.882021622588315},{"file":"src/core/mdec.cc","loc":398,"old-loc":398,"code-health":8.105407033504736,"old-code-health":8.105407033504736},{"file":"src/core/sio.cc","loc":529,"old-loc":529,"code-health":6.563946737325112,"old-code-health":6.563946737325112},{"file":"src/core/sio1.cc","loc":258,"old-loc":258,"code-health":7.771305097619841,"old-code-health":7.771305097619841},{"file":"src/gui/widgets/registers.cc","loc":446,"old-loc":446,"code-health":6.487576009930235,"old-code-health":6.487576009930235}]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"1129","analysis-time":"2025-09-21T05:33:38Z","negative-impact-count":20,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":5,"commits":["246ed238b55785a707a46bea0d130e95ec594079","aa236f7c08f9dffe6140cf2ceb76442e5cd1e9b6","ff0c7f8333463e1af28f09f8efa0159cb5b33f71","7ab43b5c7e46af68c704cf23501ee30a1a488fa4","6abd655689bab31989f8182d3aec6dc3ae1b02b3","12daafd2dc1bfbfc435da912e8bf153d9392ab80","ba42c3929a8b7cc0cdc8b58abd8f8def595162b1","ed7b6685921456d5d77ca28df0f26403ea434044","9d818e634abab56895a29c7110ade4de3065f53a","43159ab16cdcb28141c172e81c1f1aef758bc598","e5f56dc7abd1fe8651d0a7ec4a7d4c5f28442ea6","f3e746a7805b205ed79257c9cde18b18a6e37167","4c2ef615974c13bf05bb089b34c4778d5d8a4b34","48298c8a86085303c9bab1def9cddc9d25ad43d4","8627aeae0a148d44f5dc54b5b952a0cdea65db46","b117fcea92dcbb13f7ea374a468c1ed863d5ce79","16ec00835082629cf895c5671f6711494fe4789d","2957f834248b92e98797f5bb828fff54bc3997da","994904173c81bb2b3def49c4ade73d4904148953","0a1ef5890e4eccdf0565a4d808b8f0d1c90881fe","caaf0ccef4a6051c777b32fa3c60a6b20e1b861e","732ae8604aaacf576a3bd38ae6fdb7df473ed82b","b15fced8457314a0518e61085016b7cf86b7647a","574b2cd9fc46e4fea4a01738fe29ab974d30f560","20269662620bde5846f9eef9213c7ebf2df99e14","7acd39b737e4127b397d699b07ee7458c336b65e","7d984c20c122f51d62467a4f92b2ff05587657e8","bfce6d18299a7625b51c9e89963e2f4305ed909e","f303bd6bddfacbad37404b95239b7340e083fbdd","e1e7197d0764cfc7e232a8aef5423ab1bbe11606","065085f41e8385d363b65e6fd0e3786a1ea214c9","0b160ea7fd3fd1ef1e27d3337a2ad5a7316f8d8b","48a4bf2e206c34322b7e60736db05ce91a649061","d3824b1db8e1d4254376daa33bad95ce838c4d96","22b23cadabe05796c21a9941a46430d7ea6533ce","6b2e92d2027fc8b0225dedef9db8c2a0ce155a6d","36658365eb8fa7d390566ed9fbfa9320ac40a753","e188c084aeabe10e42a5419ae4f6b6c2bd268860","07c9be48ea8c4ccc70d25b8ea61cb5fb111ab29b","f6c6ccb3bf321dce9e88ebf92df6ed9d569f22ee","774d890f5f87161e963c0c76482a769841b230e3","46f0d3e0e54921ac3665c5e298d247489587256d","526e3e7e4f55c8050a00fa0ca2b5472381b117b1","ed647683fe35ce8f8484f289aa3f4c6377caaa3d","9c28ac5c0fbb553096c440f71888bd6a9ad7e178","004219074be1d359b308a11761c3573748c20c33","5f285cd1de4f64f8e7fd783e0e46ccfd505880de","f43d41beda26d10d0076811e3bfc659faef8d8d4","d2e1bbc33ffaf1d0645d0b2910783a5f4285ad97","207d78a883250fbdc4342198836f37211a187b18","2b0e6e5efeda67261e05feeb71501ba9b538e9c4","c66a9a12e032c4cbfaad8526fffc3da85a1526f8","759e953475e9b5fc89c47778b3f4650cd41bcfc9","9f46a6ec31cc6ca3dc4cce2cf9839774e707e571","7885e8ecad5fc2c83afe4e93c68e5a56597fb7e0","07e48202ee2a5913b60860b2f18ea43bf8745d6d","c8f62273486627ee61eeefec1820fbd1540ff359","ea0f273808e939aca77c09a68d39ba2d695a4b79","93642e58b69d44038d9c30ff96c0e99a070b8b25","8699443b33f0b7ed0eb2f1d335c79581cba06107","9359b93fb3cf77157352be2874c49831af83d655","dc4353c6f3aaaf20ac878126489ad7e9f2f68959","6c708f933c67d569a0262098c0cbcaa97213a9bd","199730c86afe24c9192962a39a3747b4ca9ba2cb","68152289220487cb7482214f134f9b3fda0d4506","4c90e92c1de74802e2d470ea7c74d6f3aedef842","9d43d7986c9d248ea35556c92fc7a7225149183a","a5fc9c6528433b0295073beca129930741f645d9","758b27711ea051e92d097d0256c1820d01341982","19595d7bb543ef3b75133c63ed85f77902a5dcb2","c3ac585ba65974b9731153373733ab2b83c972dd","2e619d3bffbbe15c1a4699162d8a9a7e1816fe4f","c60a08d4397cb31ea9db34beb479c8df49e2e30c","7e6d2eddff29cf6e8429623303737101a345aa03","5a290629b6bfef1b124fd20e219d86fb73b8bacb","4e3193980bc58940f6f088327baaaea75fe7c31f","db0ea115aef3a2c755524652ae40f529d0412554","dc1188b169acf72fd0560b2d05cf3b34c86dc406","623b46cb1b515357ddc0490263d897cd03c156ca","658646e3fa857f51afbbf973b33eafbc068d660b","298709cb853e0d1d7de8b5067671f4f35ef82aea","67fd76cbc6bd9aa0cb2ee7a8840f4f0a867d6e0b","e57bc6aad4d695ea97e198c3f9b2b8fdc1ecb046","ba20cbe4a85d3c9b9cc47d0e818ee54a644fcb68","5cbb19646faf51cb8dfc854db780f57761b2bb94","fd722d0d5a159f3552f278e647475caffb4f31b9","f70aa8c8e83f01748e279ed53d0e813ac6e22af5","e6a37fea5969280691e3bc328dea74c20301d406","6c2937eafb38b95a66430f08c97bd622969671fd","bff6f9a40af783f71f3106a317f6c44f8698c6c2","595f4bfbd2cae5c23cc431156e320c136baebccd","166a1b995c8ed73a4411279f4470fde0ef2157dc","76d6c313608a9bc4cedf927400c330d6b6090dee","eec231af75ebaf20bcc5c7966b4b969037b3064a","7387d6b3a3fb7a03b2db99c6a94375ebfb5a2e4d","2e96bb3e538c615aac00d841a5aa35a70a7d3b43","1de118bc9842d11d54cc77c2cf60a06e3d1dd482","28768b18eb857b36fa93f3856051e865ee64a997","1b9b57e4a9a53df4d872b7959ae296b8bc870b38","f1d387873137522ff94ac2019c47cf4c4443de94","a553382ec77877f4bfa24ad4f750349567a07098","14cc01599a541dbca2d211ca06f89954708b3ce5","1f6e8a8197ff965d5e7f3a7a69c3b8cf90b32d79","9431018b50b9909121e6d79d11274851bc82e23b","272a844a57e50840c006a8391c5fcf02ab432748","876d3544b9ba822ff0b59de79e9d3c8d4c3edbf8","c478e69ad09ba31c8a82fe3b1613ad8bc93eb152","4d4535eaaca254dd670312870ebd0b6dcd1c38a4","0fe3ef86e3057beed8e94eca7306b139f5ac8128","ffdcc5e82e8fecf7835f9f3787e6eb3667b03acb","6a696c1d9250cc49c42c857a9037b04389f77d87","129e0cfcbb66b42336318e23f80b4d170e8d8dac","eae7f845c2f150a5d57c90c0d7c86e0af372fbf0","662e1cb3c55edd11883422eaa648584ed3316ec2","87e8e0331b73cfc3908a8b16346f73dd4db6c9ca","7a47e175f3590c76e154b114efa6878d1fc408c5","4794dac7ccb42fd75a0c9d867ed6e7267fe3ab58","394f0832145ea03a8fcb528576ae601a2c5043c9","56ceed8247737a8c9154b28863457f50e3ee62cb","f2fdf8c0e291d496d8922b9437ec80af0b45f8b1","56afe7c7e72135d8036691b4b278d2d47082eddd","2169b06360de5190bcfd792c827bc45a4e23cbc1","94eaf9ad6b943f3f8f8f425068778189daff5ae1","cf0b6db28a97365e3896ae113103b00f5fa8a91f","983a245b07b1317921f03b16a35326d3726af7e4","214551182baf3abdd52f8140883c759b7d4df07f","b8938dd0699e0d1e73e80c5d41711c77bb512e98","add6d8c2e4a5477cb0f5cc0dabaa2544f365570d","2b6f1619c98fc2c5c5f4a6bddece5d87db109c68","8615a4a36806c79b0985e8672068717728daf129","c471f65a64c97a3234825a2eb34ac9b4ff0d3f2a","47c3a9e475e33074a7efb1102a5731415af4f228","57e737e3e44a1a75532c8380326248e61748e989","3d54b2e72221494b76b23d864fecad7bfa18996d","896cf1e79b99664bead2e89d1a4670e5a8c0f570","70550188ed140ae8dc8bfe3ffb2e51184b13bfc0","f1c2ffed8e4802acc4a9990687907d3140c86ccb","4ad707cf8587a21284ba5c33ec4abbebd9bb09ce","956f3abbe5a86b560dc964f76da1301e35f86b01","0352524ecfedd892d9266c298baab38918c7ddc5","4baf2f18d2fe4512ea32b5ceabdac9d880216a82","a5d77c687d24bf0b3c31f63b848dbd544cd7a432","a9523e4f194ef647960aa1d00dc7bf5c37b62f0c","672e8cea82e0dda8d53fff1a24579b2662062fa3","1a3148c166a5823a54ef49c08466aff6248023e6","1e372ddf3c1799da24d9d364a6e076753e359833","9c5bd043edf3a9ffb2d3ae5b09a2cb6129493413","3bf7e0bf3b41c141cae103967703ce6ecdc6829e","0ccc5149d698dfc843171b36cd5a4e13cdff71e1","b3f9aac2f155fab36b8ba554fdde79764d963fe9","e5a83ea2dd07d36e13b3ba585df6918c19d7a26e","da48ab85b39cbad21df73838144c7e983428dcee","92969d732f3ff06312b64c710ca177e9ec69adc7","e1ba35af18a4b8b5ecd9ececee1942adf77398dd","9d7529d18402e144c93e3e3d55e6742c2bc87494","ed4d2d9a4b05aaaf1dfdfff6c2402c258535b7cb","dfb6d45fdaffc71575242e19e7875e192c904fd7","ec27f98d0191d2cdc0415973dff1b4e520a040c2","ee670a0b2423cd8a9d13d026b385fb51939670d7","3b22b6514af1afaa5545e0747710260f872c2a79","b6da9bf613a660f327291b5af0d0a5eff3acc95e","b39d4fde82032f02111e428d0a052cf7a5b8a986","89b4301d12218670372464b98e4cf509fe58e293","63f0f2508f007d6dccf3f6b10dec6086bb8f3e85","b713abfe027385dddb8f37bfe3aadc550741a392","4bdc18aedd12b3870e9932ea19c2c1fdd7646eef","cb8cb0e6bed45b34a79289d09b8ca62f612cf301","c95b5268e2ba595d62b3c633fc812c3e7368e5ca","9ac714f7aed2e772049ced319251113bbe968c54","2532801e97d2940a40fc1544414f80d93939c12c","9c1818f2f52f06617856fa4c182d077b5cc80ec7","1a797b5db5c2fe7db95a55aaa4321692947e0805","47634e2fcf5beee0590200a62a7b9036eaee886e","2e54913ac0aad643abd0c34e6763b80a45860a01","7ed3f8d3ad36e621de3b21b46c30ec9a62bdd7df","682d7b32f1d469d7b4cb8e0038463f6e8a3432a8","87d0ed4d4f9486c93f0b4bc567beb67f110ce090","01671b714f174c2908f2776bec1ebc82f85aba24","a779b004ae076cf61e8eb40cca1b6703417a44c1","7becd07dab4b234d1200492daf1aa954192fe23b","f70eca64e40e8b3b4784a702ae48baee948c23c5","83303cf49db0b2ae0a90cefcd5c64f0dce05f527","092ce23ea0053bb74d95c130a681e882c95ca490","46817bee05311169635087141383d787c5387ab3","100f42d9398c356d8502838bbf5eb71a3c95919c","de270dbfcb2d9b233d5f6d8ec2e54d1029367433","4d05dceaed328d2fdf5844f7da24d15436ee1820","cc5012824314be186857ec92eff527078a19328e","2f882a4d0bc8a83f13077f24538db6ab05c8247e","70603840b8d81accc8e2459f2a620aa15312c2f4","7fbb8ef2025f1b98c2926ec6babf56379b45559e","0bc75b8643124c7aab7ec9648d0215f172a74497","fcff6c9cfc48f168a00c21e068a79058d5ac727b","11e03bf7b4bbac93c06dc40cf3b6454f9a40d56c","0e6a22342df91d51a893b4ff36425a078affd21c","9889fb6b628242baf11b4ea600e172dc9e5edb35","d49e02bbbd10dfbf940850b3f74f591a67f135c9","5a4c1e3060a31072dfa071cafc193ae2be8a2fe8","2d3b8633663fda16129d0bc62631e8a701613b87","dad7cd942d383c02d4280afebc709b7516a2aa53","609cdef51ac20f1c4a17727949c5988001df266c","a7e54f3a063fa2df73d0448d355d9654d90bb31b","51de2e44dea2c43c072946a5e54e2f4fcab92555","e2f4eb6da74b56bd57f4ec77a809ba104dfba57e","901300a1d62fbe7fd1012f05bc0723fa09d32e46","68192a210f0c4ecbb8e8256cd482efba217c7a62","c64112886f4334266b62bf09c07c954586aed861","02932745c5e0cfc67f2235b8d364a583e77f6239","44c3ef549052d8812748955303b4a8fb3246f31d","93a52f242dd5abd4a727fac6f2e0983715d7fb75","3ffd75a13499160a220d0d8a87b643fc60116ab9","ed239cd520587fbf31cc14e151ad0834ae57b76c","6bfe4932d656a453cfc35accc77e666c6bb8a317","c9bfa68713b638bc76714e04fdbcd9a37cbd5605","f1f438159ca629af0efc55f35492a0af6766d5ab","aae23e7571b5964d4f771b525d9db8cbe3346b48","71ba79b03a00281c7dfa7b12cd0e9347a7009af7","0d19019807ae11ceae2c28de372cab4d6baecdc3","120e856f568e02f86cb3123a9b34fb794ef976c7","8ff20720dee2f663762185060bdafc015f5cafb5","69fa64e90fab165199ef88526c3c1d426cbabf57","6b43700567c9a611e361034d86f83c5fa32b216c","32e74e5b972be0440e9c69675c535144494628c0","d7ae2747b6681cb44ad1eaf65455c19e2af31b1c","c25e5c3f80d61d15acb6e973ab49a2eecd5a3c55","b30f74beefb9b5dbcacd7e12f569848700ce2cd6","a6dd75e5af0eeaed5c69ac952b0d9a4da5431ca3","eeb6f256340b2d36c1624271387325f17dbb23c0","9044305dfd5e7198edf4fb956916450d2add1a74","4d7d1472ecc444924720b4c20dd576a99948ac07","3b2bbe267a40170e5763a42cb604b3ea052909d9"],"is-negative-review":true,"negative-findings":{"number-of-types":5,"number-of-files-touched":6,"findings":[{"method":"PCSX::CDRom::parseIso","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C++ language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/core/cdrom.cc","refactoring-examples":[{"diff":"diff --git a/complex_method.js b/complex_method.js\nindex 10cce78e6d..0c1a8cabaf 100644\n--- a/complex_method.js\n+++ b/complex_method.js\n@@ -1,15 +1,20 @@\n function postItem(item) {\n   if (!item.id) {\n-    if (item.x != null && item.y != null) {\n-      post(item);\n-    } else {\n-      throw Error(\"Item must have x and y\");\n-    }\n+    // extract a separate function for creating new item\n+    postNew(item);\n   } else {\n-    if (item.x < 10 && item.y > 25) {\n-      put(item);\n-    } else {\n-      throw Error(\"Item must have an x and y value between 10 and 25\");\n-    }\n+    // and one for updating existing items\n+    updateItem(item);\n   }\n }\n+\n+function postNew(item) {\n+  validateNew(item);\n+  post(item);\n+}\n+\n+function updateItem(item) {\n+  validateUpdate(item);\n+  put(item);\n+}\n+\n","language":"c++","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":true,"line":1286,"what-changed":"PCSX::CDRom::parseIso has a cyclomatic complexity of 15, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"introduced"},{"method":"maybeStartCommand","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C++ language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/core/cdrom.cc","refactoring-examples":[{"diff":"diff --git a/complex_method.js b/complex_method.js\nindex 10cce78e6d..0c1a8cabaf 100644\n--- a/complex_method.js\n+++ b/complex_method.js\n@@ -1,15 +1,20 @@\n function postItem(item) {\n   if (!item.id) {\n-    if (item.x != null && item.y != null) {\n-      post(item);\n-    } else {\n-      throw Error(\"Item must have x and y\");\n-    }\n+    // extract a separate function for creating new item\n+    postNew(item);\n   } else {\n-    if (item.x < 10 && item.y > 25) {\n-      put(item);\n-    } else {\n-      throw Error(\"Item must have an x and y value between 10 and 25\");\n-    }\n+    // and one for updating existing items\n+    updateItem(item);\n   }\n }\n+\n+function postNew(item) {\n+  validateNew(item);\n+  post(item);\n+}\n+\n+function updateItem(item) {\n+  validateUpdate(item);\n+  put(item);\n+}\n+\n","language":"c++","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":true,"line":713,"what-changed":"maybeStartCommand has a cyclomatic complexity of 11, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"introduced"},{"method":"cdlSetMode","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C++ language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/core/cdrom.cc","refactoring-examples":[{"diff":"diff --git a/complex_method.js b/complex_method.js\nindex 10cce78e6d..0c1a8cabaf 100644\n--- a/complex_method.js\n+++ b/complex_method.js\n@@ -1,15 +1,20 @@\n function postItem(item) {\n   if (!item.id) {\n-    if (item.x != null && item.y != null) {\n-      post(item);\n-    } else {\n-      throw Error(\"Item must have x and y\");\n-    }\n+    // extract a separate function for creating new item\n+    postNew(item);\n   } else {\n-    if (item.x < 10 && item.y > 25) {\n-      put(item);\n-    } else {\n-      throw Error(\"Item must have an x and y value between 10 and 25\");\n-    }\n+    // and one for updating existing items\n+    updateItem(item);\n   }\n }\n+\n+function postNew(item) {\n+  validateNew(item);\n+  post(item);\n+}\n+\n+function updateItem(item) {\n+  validateUpdate(item);\n+  put(item);\n+}\n+\n","language":"c++","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":true,"line":921,"what-changed":"cdlSetMode has a cyclomatic complexity of 9, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"introduced"},{"method":"getStatus","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C++ language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/core/cdrom.cc","refactoring-examples":[{"diff":"diff --git a/complex_method.js b/complex_method.js\nindex 10cce78e6d..0c1a8cabaf 100644\n--- a/complex_method.js\n+++ b/complex_method.js\n@@ -1,15 +1,20 @@\n function postItem(item) {\n   if (!item.id) {\n-    if (item.x != null && item.y != null) {\n-      post(item);\n-    } else {\n-      throw Error(\"Item must have x and y\");\n-    }\n+    // extract a separate function for creating new item\n+    postNew(item);\n   } else {\n-    if (item.x < 10 && item.y > 25) {\n-      put(item);\n-    } else {\n-      throw Error(\"Item must have an x and y value between 10 and 25\");\n-    }\n+    // and one for updating existing items\n+    updateItem(item);\n   }\n }\n+\n+function postNew(item) {\n+  validateNew(item);\n+  post(item);\n+}\n+\n+function updateItem(item) {\n+  validateUpdate(item);\n+  put(item);\n+}\n+\n","language":"c++","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":true,"line":314,"what-changed":"getStatus has a cyclomatic complexity of 9, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"introduced"},{"method":"maybeTriggerIRQ","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/core/cdrom.cc","refactoring-examples":null,"change-level":"warning","is-hotspot?":true,"line":282,"what-changed":"maybeTriggerIRQ has 3 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"introduced"},{"method":"maybeStartCommand","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/core/cdrom.cc","refactoring-examples":null,"change-level":"warning","is-hotspot?":true,"line":713,"what-changed":"maybeStartCommand has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"introduced"},{"method":"cdlSetMode","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/core/cdrom.cc","refactoring-examples":null,"change-level":"warning","is-hotspot?":true,"line":921,"what-changed":"cdlSetMode has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"introduced"},{"method":"cdlSeekL","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/core/cdrom.cc","refactoring-examples":null,"change-level":"warning","is-hotspot?":true,"line":1023,"what-changed":"cdlSeekL has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"introduced"},{"method":"cdlSeekP","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/core/cdrom.cc","refactoring-examples":null,"change-level":"warning","is-hotspot?":true,"line":1060,"what-changed":"cdlSeekP has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"introduced"},{"method":"PCSX::CDRom::parseIso","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/core/cdrom.cc","refactoring-examples":null,"change-level":"warning","is-hotspot?":true,"line":1286,"what-changed":"PCSX::CDRom::parseIso has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"introduced"},{"why-it-occurs":"Code that uses a high degree of built-in, primitives such as integers, strings, floats, lacks a domain language that encapsulates the validation and semantics of function arguments. Primitive Obsession has several consequences: 1) In a statically typed language, the compiler will detect less erroneous assignments. 2) Security impact since the possible value range of a variable/argument isn't retricted.\n\nIn this module, 34 % of all functions have primitive types as arguments.","name":"Primitive Obsession","file":"src/core/cdrom.cc","refactoring-examples":[{"diff":"diff --git a/primitive-obsession.ts b/primitive-obsession.ts\nindex 38bae186cc..24116eddcc 100644\n--- a/primitive-obsession.ts\n+++ b/primitive-obsession.ts\n@@ -1,8 +1,8 @@\n-// Problem: It's hard to know what this function does, and what values are valid as parameters.\n-function getPopularRepositories(String baseURL, String query, Integer pages, Integer pageSize, String sortorder): Json {\n-\tlet pages == null ? 10 : pages\n-\tlet pageSize == null ? 10 : pageSize\n-  return httpClient.get(`${baseURL}?q=${query}&pages=${pages}&pageSize=${pageSize}&sortorder=${sortorder}`)\n+// Refactoring: extract the pagination & API logic into a class, and it will\n+// attract validation and other logic related to the specific query. It's now\n+// easier to use and to maintain the getPopularRepositories function!\n+function getPopularRepositories(query: PaginatedRepoQuery): Json {\n+  return httpClient.get(query.getURL())\n     .map(json => json.repositories)\n     .filter(repository => repositry.stargazersCount > 1000)\n }\n","language":"c++","improvement-type":"Primitive Obsession"}],"change-level":"warning","is-hotspot?":true,"what-changed":"In this module, 34.5% of all function arguments are primitive types, threshold = 30.0%","how-to-fix":"Primitive Obsession indicates a missing domain language. Introduce data types that encapsulate the details and constraints of your domain. For example, instead of `int userId`, consider `User clicked`.","change-type":"introduced"},{"why-it-occurs":"Duplicated code often leads to code that's harder to change since the same logical change has to be done in multiple functions. More duplication gives lower code health.","name":"Code Duplication","file":"src/mips/tests/cdrom/cester-hw.c","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":214,"what-changed":"The module contains 2 functions with similar structure: seekLTo,seekPTo","how-to-fix":"A certain degree of duplicated code might be acceptable. The problems start when it is the same behavior that is duplicated across the functions in the module, ie. a violation of the Don't Repeat Yourself (DRY) principle. DRY violations lead to code that is changed together in predictable patterns, which is both expensive and risky. DRY violations can be identified using CodeScene's X-Ray analysis to detect clusters of change coupled functions with high code similarity. [Read More](https://codescene.com/blog/software-revolution-part3/)\n\nOnce you have identified the similarities across functions, look to extract and encapsulate the concept that varies into its own function(s). These shared abstractions can then be re-used, which minimizes the amount of duplication and simplifies change.","change-type":"introduced"},{"method":"hexdump","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/mips/tests/cdrom/cester-hw.c","refactoring-examples":[{"diff":"diff --git a/complex_method.js b/complex_method.js\nindex 10cce78e6d..0c1a8cabaf 100644\n--- a/complex_method.js\n+++ b/complex_method.js\n@@ -1,15 +1,20 @@\n function postItem(item) {\n   if (!item.id) {\n-    if (item.x != null && item.y != null) {\n-      post(item);\n-    } else {\n-      throw Error(\"Item must have x and y\");\n-    }\n+    // extract a separate function for creating new item\n+    postNew(item);\n   } else {\n-    if (item.x < 10 && item.y > 25) {\n-      put(item);\n-    } else {\n-      throw Error(\"Item must have an x and y value between 10 and 25\");\n-    }\n+    // and one for updating existing items\n+    updateItem(item);\n   }\n }\n+\n+function postNew(item) {\n+  validateNew(item);\n+  post(item);\n+}\n+\n+function updateItem(item) {\n+  validateUpdate(item);\n+  put(item);\n+}\n+\n","language":"c","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":false,"line":35,"what-changed":"hexdump has a cyclomatic complexity of 11, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"introduced"},{"method":"hexdump","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/mips/tests/cdrom/cester-hw.c","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":35,"what-changed":"hexdump has 3 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"introduced"},{"method":"hexdump","why-it-occurs":"Deep nested logic means that you have control structures like if-statements or loops inside other control structures. Deep nested logic increases the cognitive load on the programmer reading the code. The human working memory has a maximum capacity of 3-4 items; beyond that threshold, we struggle with keeping things in our head. Consequently, deep nested logic has a strong correlation to defects and accounts for roughly 20% of all programming mistakes.\n\nCodeScene measures the maximum nesting depth inside each function. The deeper the nesting, the lower the code health. The threshold for the C language is 4 levels of nesting.","name":"Deep, Nested Complexity","file":"src/mips/tests/cdrom/cester-hw.c","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":35,"what-changed":"hexdump has a nested complexity depth of 4, threshold = 4","how-to-fix":"Occassionally, it's possible to get rid of the nested logic by [Replacing Conditionals with Guard Clauses](https://refactoring.com/catalog/replaceNestedConditionalWithGuardClauses.html).\n\nAnother viable strategy is to identify smaller building blocks inside the nested chunks of logic and extract those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring explains the steps.","change-type":"introduced"},{"method":"parse","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"third_party/cueparser/cueparser.c","refactoring-examples":[{"diff":"diff --git a/complex_method.js b/complex_method.js\nindex 10cce78e6d..0c1a8cabaf 100644\n--- a/complex_method.js\n+++ b/complex_method.js\n@@ -1,15 +1,20 @@\n function postItem(item) {\n   if (!item.id) {\n-    if (item.x != null && item.y != null) {\n-      post(item);\n-    } else {\n-      throw Error(\"Item must have x and y\");\n-    }\n+    // extract a separate function for creating new item\n+    postNew(item);\n   } else {\n-    if (item.x < 10 && item.y > 25) {\n-      put(item);\n-    } else {\n-      throw Error(\"Item must have an x and y value between 10 and 25\");\n-    }\n+    // and one for updating existing items\n+    updateItem(item);\n   }\n }\n+\n+function postNew(item) {\n+  validateNew(item);\n+  post(item);\n+}\n+\n+function updateItem(item) {\n+  validateUpdate(item);\n+  put(item);\n+}\n+\n","language":"c","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":false,"line":216,"what-changed":"parse increases in cyclomatic complexity from 117 to 119, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"degraded"},{"method":"PCSX::CDRIso::getLocP","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/cdrom/cdriso.cc","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":425,"what-changed":"PCSX::CDRIso::getLocP has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"introduced"},{"method":"PCSX::CDRIso::getTrack","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/cdrom/cdriso.cc","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":456,"what-changed":"PCSX::CDRIso::getTrack has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"introduced"},{"method":"DynaRecCPU::recompile","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C++ language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/core/DynaRec_aa64/recompiler.cc","refactoring-examples":[{"diff":"diff --git a/complex_method.js b/complex_method.js\nindex 10cce78e6d..0c1a8cabaf 100644\n--- a/complex_method.js\n+++ b/complex_method.js\n@@ -1,15 +1,20 @@\n function postItem(item) {\n   if (!item.id) {\n-    if (item.x != null && item.y != null) {\n-      post(item);\n-    } else {\n-      throw Error(\"Item must have x and y\");\n-    }\n+    // extract a separate function for creating new item\n+    postNew(item);\n   } else {\n-    if (item.x < 10 && item.y > 25) {\n-      put(item);\n-    } else {\n-      throw Error(\"Item must have an x and y value between 10 and 25\");\n-    }\n+    // and one for updating existing items\n+    updateItem(item);\n   }\n }\n+\n+function postNew(item) {\n+  validateNew(item);\n+  post(item);\n+}\n+\n+function updateItem(item) {\n+  validateUpdate(item);\n+  put(item);\n+}\n+\n","language":"c++","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":true,"line":237,"what-changed":"DynaRecCPU::recompile increases in cyclomatic complexity from 13 to 14, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"degraded"},{"method":"DynaRecCPU::recompile","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C++ language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/core/DynaRec_x64/recompiler.cc","refactoring-examples":[{"diff":"diff --git a/complex_method.js b/complex_method.js\nindex 10cce78e6d..0c1a8cabaf 100644\n--- a/complex_method.js\n+++ b/complex_method.js\n@@ -1,15 +1,20 @@\n function postItem(item) {\n   if (!item.id) {\n-    if (item.x != null && item.y != null) {\n-      post(item);\n-    } else {\n-      throw Error(\"Item must have x and y\");\n-    }\n+    // extract a separate function for creating new item\n+    postNew(item);\n   } else {\n-    if (item.x < 10 && item.y > 25) {\n-      put(item);\n-    } else {\n-      throw Error(\"Item must have an x and y value between 10 and 25\");\n-    }\n+    // and one for updating existing items\n+    updateItem(item);\n   }\n }\n+\n+function postNew(item) {\n+  validateNew(item);\n+  post(item);\n+}\n+\n+function updateItem(item) {\n+  validateUpdate(item);\n+  put(item);\n+}\n+\n","language":"c++","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":true,"line":319,"what-changed":"DynaRecCPU::recompile increases in cyclomatic complexity from 22 to 23, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"degraded"}]},"positive-impact-count":13,"repo":"pcsx-redux","code-health":6.083194865749198,"version":"3.0","authors":["Nicolas \"Pixel\" Noble","Nicolas 'Pixel' Noble","Caleb Yates"],"directives":{"added":[],"removed":[]},"positive-findings":{"number-of-types":6,"number-of-files-touched":7,"findings":[{"method":"logCDROM","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C++ language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/core/cdrom.cc","change-level":"improvement","is-hotspot?":true,"line":1208,"what-changed":"logCDROM decreases in cyclomatic complexity from 22 to 21, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"improved"},{"method":"PCSX::CDRom::check","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C++ language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/core/cdrom.cc","change-level":"improvement","is-hotspot?":true,"line":1672,"what-changed":"PCSX::CDRom::check is no longer above the threshold for cyclomatic complexity","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"fixed"},{"method":"readTrack","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/core/cdrom.cc","change-level":"improvement","is-hotspot?":true,"line":405,"what-changed":"readTrack is no longer above the threshold for logical blocks with deeply nested code","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"fixed"},{"method":"PCSX::CDRom::check","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/core/cdrom.cc","change-level":"improvement","is-hotspot?":true,"line":1672,"what-changed":"PCSX::CDRom::check is no longer above the threshold for logical blocks with deeply nested code","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"fixed"},{"name":"Overall Code Complexity","file":"src/core/cdrom.cc","change-type":"fixed","change-level":"improvement","is-hotspot?":true,"why-it-occurs":"Overall Code Complexity is measured by the mean cyclomatic complexity across all functions in the file. The lower the number, the better.\n\nCyclomatic complexity is a function level metric that measures the number of logical branches (if-else, loops, etc.). Cyclomatic complexity is a rough complexity measure, but useful as a way of estimating the minimum number of unit tests you would need. As such, prefer functions with low cyclomatic complexity (2-3 branches).","how-to-fix":"You address the overall cyclomatic complexity by a) modularizing the code, and b) abstract away the complexity. Let's look at some examples:\n\nModularizing the Code: Do an X-Ray and inspect the local hotspots. Are there any complex conditional expressions? If yes, then do a [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring. Extract the conditional logic into a separate function and put a good name on that function. This clarifies the intent and makes the original function easier to read. Repeat until all complex conditional expressions have been simplified.\n\n","what-changed":"The mean cyclomatic complexity in this module is no longer above the threshold"},{"method":"PCSX::R3000Acpu::branchTest","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C++ language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/core/r3000a.cc","change-level":"improvement","is-hotspot?":false,"line":331,"what-changed":"PCSX::R3000Acpu::branchTest decreases in cyclomatic complexity from 14 to 11, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"improved"},{"method":"PCSX::R3000Acpu::branchTest","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/core/r3000a.cc","change-level":"improvement","is-hotspot?":false,"line":331,"what-changed":"PCSX::R3000Acpu::branchTest decreases from 3 to 2 logical blocks with deeply nested code, threshold is one single block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"improved"},{"name":"Overall Code Complexity","file":"src/core/r3000a.cc","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Overall Code Complexity is measured by the mean cyclomatic complexity across all functions in the file. The lower the number, the better.\n\nCyclomatic complexity is a function level metric that measures the number of logical branches (if-else, loops, etc.). Cyclomatic complexity is a rough complexity measure, but useful as a way of estimating the minimum number of unit tests you would need. As such, prefer functions with low cyclomatic complexity (2-3 branches).","how-to-fix":"You address the overall cyclomatic complexity by a) modularizing the code, and b) abstract away the complexity. Let's look at some examples:\n\nModularizing the Code: Do an X-Ray and inspect the local hotspots. Are there any complex conditional expressions? If yes, then do a [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring. Extract the conditional logic into a separate function and put a good name on that function. This clarifies the intent and makes the original function easier to read. Repeat until all complex conditional expressions have been simplified.\n\n","what-changed":"The mean cyclomatic complexity decreases from 6.36 to 6.14, threshold = 4"},{"method":"PCSX::SaveStates::constructSaveState","why-it-occurs":"Overly long functions make the code harder to read. The recommended maximum function length for the C++ language is 70 lines of code. Severity: Brain Method - Complex Method - Long Method.","name":"Large Method","file":"src/core/sstate.cc","change-level":"improvement","is-hotspot?":false,"line":33,"what-changed":"PCSX::SaveStates::constructSaveState decreases from 138 to 86 lines of code, threshold = 70","how-to-fix":"We recommend to be careful here -- just splitting long functions don't necessarily make the code easier to read. Instead, look for natural chunks inside the functions that expresses a specific task or concern. Often, such concerns are indicated by a Code Comment followed by an if-statement. Use the [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring to encapsulate that concern.","change-type":"improved"},{"name":"Lines of Code in a Single File","file":"src/gui/gui.cc","change-type":"improved","change-level":"improvement","is-hotspot?":true,"why-it-occurs":"This module has 2460 lines of code (comments stripped away). This puts the module at risk of evolving into a Brain Class. Brain Classes are problematic since changes become more complex over time, harder to test, and challenging to refactor. Act now to prevent future maintenance issues.","how-to-fix":"Look for opportunities to modularize the design. This is done by identifying groups of functions that represent different responsibilities and/or operate on different data. Once you have identified the different responsibilities, then use refactorings like [EXTRACT CLASS](https://refactoring.com/catalog/extractClass.html).","what-changed":"The lines of code decreases from 2464 to 2460, improve code health by reducing it to 1000"},{"method":"parse","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"third_party/cueparser/cueparser.c","change-level":"improvement","is-hotspot?":false,"line":216,"what-changed":"parse decreases from 11 to 10 logical blocks with deeply nested code, threshold is one single block per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"improved"},{"name":"Primitive Obsession","file":"src/cdrom/cdriso.cc","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Code that uses a high degree of built-in, primitives such as integers, strings, floats, lacks a domain language that encapsulates the validation and semantics of function arguments. Primitive Obsession has several consequences: 1) In a statically typed language, the compiler will detect less erroneous assignments. 2) Security impact since the possible value range of a variable/argument isn't retricted.\n\nIn this module, 38 % of all functions have primitive types as arguments.","how-to-fix":"Primitive Obsession indicates a missing domain language. Introduce data types that encapsulate the details and constraints of your domain. For example, instead of `int userId`, consider `User clicked`.","what-changed":"The ratio of primitive types in function arguments decreases from 41.38% to 37.50%, threshold = 30.0%"},{"method":"PCSX::SIO1::interrupt","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/core/sio1.cc","change-level":"improvement","is-hotspot?":false,"line":129,"what-changed":"PCSX::SIO1::interrupt is no longer above the threshold for logical blocks with deeply nested code","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"fixed"}]},"notices":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"external-review-provider":"GitHub"},"analysistime":"2025-09-21T05:33:38.000Z","project-name":"pcsx-redux","repository":"https://github.com/grumpycoders/pcsx-redux.git"}}