mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-11-13 21:10:30 +00:00
Fix all headers
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
---
|
||||
layout: page
|
||||
title: "Style guidelines"
|
||||
description: "Details about styling your code."
|
||||
date: 2017-04-28 20:00
|
||||
sidebar: true
|
||||
comments: false
|
||||
sharing: true
|
||||
footer: true
|
||||
---
|
||||
|
||||
Home Assistant enforces strict [PEP8 style](https://www.python.org/dev/peps/pep-0008/) and [PEP 257 (Docstring Conventions)](https://www.python.org/dev/peps/pep-0257/) compliance on all code submitted. We automatically test every pull request as part of the linting process with [Coveralls](https://coveralls.io/github/home-assistant/home-assistant) and [Travis CI](https://travis-ci.org/home-assistant/home-assistant).
|
||||
@@ -25,11 +19,11 @@ The maximum line length comes directly from the [PEP8 style guide](https://www.p
|
||||
|
||||
Those points may require that you adjust your IDE or editor settings.
|
||||
|
||||
## {% linkable_title Our recommendations %}
|
||||
## Our recommendations
|
||||
|
||||
For some cases [PEPs](https://www.python.org/dev/peps/) don't make a statement. This section covers our recommendations about the code style. Those points were collected from the existing code and based on what contributors and developers were using the most. This is basically a majority decision, thus you may not agree with it. But we would like to encourage you follow those recommendations to keep the code unified.
|
||||
|
||||
### {% linkable_title Quotes %}
|
||||
### Quotes
|
||||
|
||||
Use single quotes `'` for single word and `"` for multiple words or sentences.
|
||||
|
||||
@@ -41,7 +35,7 @@ SENSOR_TYPES = {
|
||||
}
|
||||
```
|
||||
|
||||
### {% linkable_title File headers %}
|
||||
### File headers
|
||||
|
||||
The docstring in the file header should contain a link to the documentation to make it easy to find further information, especially about the configuration or details which are not mentioned in the code.
|
||||
|
||||
@@ -54,7 +48,7 @@ https://home-assistant.io/components/light.mqtt/
|
||||
"""
|
||||
```
|
||||
|
||||
### {% linkable_title Requirements %}
|
||||
### Requirements
|
||||
|
||||
Please place [Platform requirements](/developers/code_review_platform/#1-requirements) right after the imports.
|
||||
|
||||
@@ -65,7 +59,7 @@ from homeassistant.helpers.entity import Entity
|
||||
REQUIREMENTS = ['xmltodict==0.11.0']
|
||||
```
|
||||
|
||||
### {% linkable_title Log messages %}
|
||||
### Log messages
|
||||
|
||||
There is no need to add the platform or component name to the log messages. This will be added automatically. Like `syslog` messages there shouldn't be any period at the end. Try to avoid brackets and additional quotes around the output to make it easier for users to parse the log. A widely style is shown below but you are free to compose the messages as you like.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user