aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M <dstftw@gmail.com>2019-01-01 23:50:02 +0700
committerGitHub <noreply@github.com>2019-01-01 23:50:02 +0700
commit8437f5089f2fac85a249c4368c2ea1415955d8b0 (patch)
tree248b97f5268a576462b6e046ef7b0fb673e202ec
parent1d803085d730bf2aaf54e5cea2362133b3fdb831 (diff)
[README.md] Add long lines policy to coding conventions
-rw-r--r--README.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/README.md b/README.md
index bdc5faeec..901595444 100644
--- a/README.md
+++ b/README.md
@@ -1192,6 +1192,25 @@ title = self._search_regex(
webpage, 'title', group='title')
```
+### Long lines policy
+
+There is a soft limit to keep lines of code under 80 characters long. This means it should be respected if possible and if it does not make readability and code maintenance worse.
+
+For example, you should **never** split long string literals like URLs or some other often copied entities over multiple lines to fit this limit:
+
+Correct:
+
+```python
+'https://www.youtube.com/watch?v=FqZTN594JQw&list=PLMYEtVRpaqY00V9W81Cwmzp6N6vZqfUKD4'
+```
+
+Incorrect:
+
+```python
+'https://www.youtube.com/watch?v=FqZTN594JQw&list='
+'PLMYEtVRpaqY00V9W81Cwmzp6N6vZqfUKD4'
+```
+
### Use safe conversion functions
Wrap all extracted numeric data into safe functions from [`youtube_dl/utils.py`](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/utils.py): `int_or_none`, `float_or_none`. Use them for string to number conversions as well.