Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

naming-convention

Flags names that don’t follow Garmin’s Monkey C coding conventions.

Why

Consistent names tell you what something is at a glance, like whether myThing is a class or a function. The rules below follow Garmin’s conventions.

What it flags

KindConventionExample
Modules and classesPascalCaseMyClass
Functions and parameterscamelCasemyFunction(myArg)
Public class memberscamelCasevar myValue;
Private, protected and hidden members_camelCaseprivate var _value;
VariablescamelCasevar myTotal = 0;
Enum valuesSCREAMING_SNAKE_CASE, one prefixCOLOR_RED, COLOR_BLUE

What it leaves alone

Constants. Garmin’s conventions don’t say how to name them, so const names aren’t checked. The SDK itself mostly uses SCREAMING_SNAKE_CASE for them.

Example

class example {
    var Value = 1;
    private var mCounter as Number = 0;

    function MyFn() {}
}

Each finding suggests a name that follows the convention, like Example for example and _mCounter for mCounter. There’s no fix, since renaming something means changing every place it’s used.