Alex Thottunkel
- Total activity 2329
- Last activity
- Member since
- Following 0 users
- Followed by 0 users
- Votes 1
- Subscriptions 1176
Articles
Recent activity by Alex Thottunkel Sort by recent activity-
Logical OR should not be used in switch cases
Why you should care The logical OR operator (||) will not work in a switch case as one might think, only the first argument will be considered at execution time. How we detect CAST Highlight coun...
-
In switch 'default' clauses should be last
Why you should care Switch can contain a default clause for various reasons: to handle unexpected values, to show that all the cases were properly considered. For code readability purpose, to hel...
-
Avoid caching selector for long time
Why you should care Since object members may contain other members, it’s not uncommon to see patterns such as window.location.href in JavaScript code. These nested members cause the JavaScript eng...
-
URIs (URL & path) should not be hardcoded for testability purpose
Why you should care Hard coding a URI makes it difficult to test a program: path literals are not always portable across operating systems, a given absolute path may not exist on a specific test e...
-
try! should not be used
Why you should care The use of Swift 2.0's try! lets you execute code that might throw an exception without using the do and catch syntax normally required for such code. By using it, you're guara...
-
A field should not duplicate the name of its containing class
Why you should care It can be confusing to have a class member with the same name (case differences aside) as its enclosing class, especialy when considering the common practice of naming a class ...
-
Use == instead of ?: when dealing with nullable boolean
Why you should care Nullable boolean can be null, or having a value "true" or "false". var a: Boolean? // a is a nullable boolean Before accessing the value, we should verify if the variable is...
-
The code contain too many unused private methods
Why you should care Private methods that are never executed are dead code: unnecessary, inoperative code that should be removed. Cleaning out dead code decreases the size of the maintained codebas...
-
Prefer using expression Form for ‘if’ or ‘when’ in place of statement syntax
Why you should care In Kotlin, "if" and "when" returns a value, and so can be used as expression. When possible, prefer using the expression form. How we detect CAST Highlight counts one occurren...
-
Do not use a labeled return for the last statement in a lambda
Why you should care The return keyword is relative to the nearest enclosing function (or anonymous function). So for returning from lambda, a labeled return is needed. But as recommended by offici...