/**
* copyright SmartThings 20XX here
*
*/
import package.name.here
...
if (no_space_after_if) {
assert_fail()
} else if (conditional_is_very_long &&
it_should_have_its_own_line ||
you.told_to_fix_it()) {
some_code.goes_here()
} else if (empty_block) {} #just put it on one line
...
def camelCaseFunctions(descriptive_argument_name) {
# if you're doing something device-specific or hacky, leave a comment
device.getDataValue("manufacturer") == "Yale" ? do_this() : []
}
def getTHIS_IS_A_CONSTANT {0xDEADBEEF}
- copyright statement first
- imports under copyright statement
- tabs, not spaces
- "K&R style" braces:
- opening braces on same line as statement
- closing braces on their own line except for
else-ifs
- one empty line between functions
- space after
if
before conditions - break up huge
if
conditionals after the operator, one tab beyond where top conditional starts- same applies to long function calls & explicit lists
- function names are
camelCased
- constants are in
CAPS_WTIH_UNDERSCORES
Mostly-complete guide here.
Donald actively maintains this guide.
Just include manufacturer
and model
. No more need for inClusters
, outClusters
, or profileId
.
- changes to existing DTHs
- (re)moving fingerprints
device.getDataValue
dependencies- device-specific configurations
- changing capabilities
- local execution restrictions/bugs
If you wrote it, you support it.