Skip to content

Commit fbd6ecb

Browse files
authored
Add copy about static, component image generator & large PRs (#53)
1 parent 014921f commit fbd6ecb

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

docs/contributing/code.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ In general, we try to avoid use of external libraries.
5959
- Components **must** use the provided abstractions like `sensor`, `switch`, etc. and should inherit from either
6060
`Component` or `PollingComponent`.
6161
- Components should **not** directly access other components -- for example, to publish to MQTT topics.
62+
- Use of `static` variables within component/platform classes is not permitted, as this is likely to cause problems
63+
when multiple instances of the component/platform are created.
6264
- Components are required to dump their configuration using `ESP_LOGCONFIG` in the `dump_config()` method. This method
6365
is used **exclusively** to **print values** determined during `setup()` -- nothing more.
6466
- For time tracking, use `App.get_loop_component_start_time()` rather than `millis()`. Hardware time reads are slow

docs/contributing/docs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ If you're not familiar with rST, see [rST syntax](#rst-syntax) for a quick prime
2020
- Dependent components (Instead, include a sentence explaining the dependency and a link to the dependency's
2121
documentation)
2222
- Pin numbers used in examples should be the string `GPIOXX` -- not a specific pin number.
23+
- When adding (a) new component(s)/platform(s), be sure to update the [main index page](https://esphome.io/components/)
24+
appropriately:
25+
- Insert your new component/platform _alphabetically_ into the relevant list(s) -- do **not** just append to the
26+
end of any given component/platform list.
27+
- If you need an image for your new component/platform, use our
28+
[component image generator](https://github.com/esphome/component-image-generator). You can run this in a
29+
container locally to generate the image or summon our bot to do so by adding a comment to your PR in the
30+
`esphome-docs` repository: `@esphomebot generate image MyNewComponent`
2331
- If a component/platform is used exclusively/primarily on a single specific board (perhaps with dedicated pin
2432
numbers), a complete configuration for the component/platform on that specific board may be included as an example
2533
_at the end of the document._ This example must be clearly identified as being for that specific hardware and it may

docs/contributing/submitting-your-work.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,30 @@ here are some tips:
8585
time commenting on/correcting your PR because you didn't name variables correctly or didn't prefix member variable
8686
accesses with `this->`, it wastes time we could be using to review other PRs which *do* follow the standards.
8787
- If you wish to take on a big project, such as refactoring a substantial section of the codebase or integrating
88-
another open source project with ESPHome, please discuss this with us on [Discord](https://discord.gg/KhAMKrd) or
88+
another open source project with ESPHome, please discuss this with us on [Discord](https://esphome.io/chat) or
8989
[create a discussion on GitHub](https://github.com/esphome/esphome/discussions) **before** you do all the work and
9090
attempt to submit a massive PR.
9191
- If you are not sure about how you should proceed with some changes, **please**
92-
[discuss it with us on Discord](https://discord.gg/KhAMKrd) **before** you go do a bunch of work that we can't (for
92+
[discuss it with us on Discord](https://esphome.io/chat) **before** you go do a bunch of work that we can't (for
9393
whatever reason) accept...and then you have to go back and re-do it all to get your PR merged. It's easier to make
9494
corrections early-on -- and we want to help you!
9595

96+
#### How to approach large submissions
97+
98+
If you have a (very) large amount of code (thousands of lines) you want to submit:
99+
100+
- [Discuss it with us on Discord](https://esphome.io/chat) **before** you begin the work.
101+
- **Carefully plan a way to break the work into a series of smaller changes** which can be submitted independently of
102+
each other. For example, consider a piece of sensor hardware which provides measurements of seven different
103+
environmental parameters and can be connected via either I2C or SPI; the work might be broken into separate PRs for:
104+
- Implementing the base "hub" component
105+
- Extending the base for both I2C and SPI connectivity
106+
- Adding the various sensor platforms to make available the data the sensor reports
107+
- It's reasonable to submit all the PRs at once, but, if you do so, be sure to:
108+
- Link them together in the PR descriptions so that reviewers can follow the work.
109+
- Indicate the order in which the PRs should be reviewed and/or merged, if relevant.
110+
- Minimize (the potential for) conflicts as much as reasonably possible.
111+
96112
## Can I Help Review PRs?
97113

98114
**YES! PLEASE!!!**

0 commit comments

Comments
 (0)