You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Roku a lot of projects make use of custom Helper methods to validate and set data. For example:
function isBoolean(obj as dynamic) as boolean
return obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
end function
These are used to enforce safety (prevent Channel crashes), for readability and for less typing of code.
If would be good to define a list of Helper methods for that project, that should be used in place of the Roku native checking. For example:
Use: getCount(NODE) or getCount(AA)
Replaces: NODE.getChildCount() and AA.count() and ARRAY.count()
This rule would also need to define a single file and/or list of exceptions (for Task Node loops etc.) that are exempt from using the Helper Util methods.
The text was updated successfully, but these errors were encountered:
How would you envision detecting spots where these helpers should have been used? Would you look for any place where a GetInterface(whateverVar, "ifBoolean") is used and then warn about needing to use a helper instead? Or does the line also need to include an invalid check before you show the warning?
How would you let the user define the name of a helper function in the bsconfig? I'm guessing you'd need to carve out specific primitive types in bslint because each type might have slightly different type checking syntax that would require specific logic in bslint to detect. Something like this?
On Roku a lot of projects make use of custom Helper methods to validate and set data. For example:
These are used to enforce safety (prevent Channel crashes), for readability and for less typing of code.
If would be good to define a list of Helper methods for that project, that should be used in place of the Roku native checking. For example:
Use: getCount(NODE) or getCount(AA)
Replaces: NODE.getChildCount() and AA.count() and ARRAY.count()
This rule would also need to define a single file and/or list of exceptions (for Task Node loops etc.) that are exempt from using the Helper Util methods.
The text was updated successfully, but these errors were encountered: