mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-24 22:25:27 +00:00
c1fe42fede
When handling special cases that are logically distinct from the function's main branch, it improves code quality (through readability and maintainability) to place those first and with an early return. The has the benefit of the main return statement being easy to find at the end of the function. (Not early and/or in a block). It also means when working on the code, there is generally a less complexity and fewer nesting levels, given that most code is in the main branch. This makes is easier and quicker to verify that code does what it should, as well as making it easy to extend in the future. When considering to add code to end of a function's main scope, it should relate to the function's main branch by default, not a special case. For example, a getName() method should not end with a top-level statement 'return false' (unless it is a stub). Rather, one would expect it to end with `return name`. Change-Id: I1f3088f2409c82dd3bf757fc8fa27dc97ae2767b |
||
---|---|---|
.. | ||
AB.js | ||
DownloadIcon.js | ||
errorLogging.js | ||
init.js | ||
initLogging.js | ||
mobileRedirect.js | ||
pageIssues.js | ||
pageIssuesLogger.js | ||
PageIssuesOverlay.js | ||
PageIssuesOverlay.less | ||
PageIssuesOverlayContent.hogan | ||
pageIssuesParser.js | ||
preInit.js | ||
references.js | ||
search.js | ||
styles.less |