Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add naming convention #2061

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions developers/guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ The structure of a binding follows the structure of a typical OSGi bundle projec
|---- java Your Java code
|-------- org/openhab/[...]
|- src/main/resources/OH-INF
|---- binding
|-------- binding.xml Binding name, description and other meta data
|---- addon
|-------- addon.xml Binding name, description and other meta data
|---- config Configuration description files when not in things files
|-------- *.xml
|---- i18n Your localized binding texts
Expand All @@ -51,6 +51,20 @@ The structure of a binding follows the structure of a typical OSGi bundle projec

## B. Code formatting rules & style

### Naming Convention

To ensure consistency for users, new bindings should use the following naming convention:

- Thing type id: `lower-case-hyphen`
- Channel type id: `lower-case-hyphen`
- Channel group id: `lower-case-hyphen`
- Channel id: `lower-case-hyphen`
- Thing property: `camelCase`
- Config parameter: `camelCase`
- Profile URI: `lower-case-hyphen`
- Profile type id for transformations: `UPPER_CASE`
- XML files in src/*/resources: `lower-case-hyphen.xml`

### Code format

In order to keep the code layout consistent, code formatting rules have been defined.
Expand Down Expand Up @@ -82,7 +96,6 @@ The rules are defined at <https://github.com/openhab/static-code-analysis/tree/m
### Java Coding Style

- The [Java naming conventions](https://java.about.com/od/javasyntax/a/nameconventions.htm) should always be used and are described in detail at the link, a quick summary is:
- Channel IDs: `lowerCamelCase`
- Variables: `lowerCamelCase`
- Constants: `ALL_UPPER_CASE`
- Generics must be used where applicable. See example below:
Expand Down