From 9283d08e35a2f46b0413d0880fe0f509b7adf993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Sun, 20 Oct 2019 13:58:32 +0700 Subject: [PATCH] [CONTRIBUTING.md] Fix typos and revise a few coding styles * Relax the 80-column limit * More as examples of call("arg") to avoid misunderstanding that only call"arg" is preferred. --- CONTRIBUTING.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba297be..7d157cf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,7 +78,7 @@ In any case, thank you very much for your contributions! This section introduces a guideline for writing idiomatic, robust and future-proof widget type code. -### Whitespces in Expressions and Statements +### Whitespace in Expressions and Statements Avoid extraneous whitespace in the following situations: @@ -92,7 +92,7 @@ Avoid extraneous whitespace in the following situations: * Immediately before a comma, semicolon, or colon. * Immediately before the open parenthesis, braces, quote, etc. - that starts the argument list of a function call; or the open braket + that starts the argument list of a function call; or the open bracket that starts an indexing. In other words, prefer these: ```lua @@ -133,7 +133,7 @@ long_function_call( baz) ``` -The closing brace or braket on multiline constructs may either line up under +The closing brace or bracket on multi-line constructs may either line up under the first character of the line that starts the construct, as in: ```lua @@ -152,12 +152,14 @@ Trailing right parentheses, however, are not allowed. ### Maximum Line Length -Limit all *code* lines to a maximum of 80 characters. -Comments and long strings need not to follow this restriction. +If possible, try to limit all *code* lines to a maximum +of 80 characters. In case you find some lines in your patch would be +more readable exceeding this limit, feel free to discuss with us. +Comments and long strings need not to follow this restriction however. -As one might have noticed, the syntatic sugars `f{}` +As one might have noticed, the syntactic sugars `f{}` (for `f({})`) and `f''` (or `f""`/`f[[]]`, -for `f('')`) are espescially prefered to squeeze +for `f('')`) are especially preferred to squeeze the line length to this limit. ### Blank Lines @@ -187,9 +189,9 @@ For example, local type = type local table = { concat = table.concat, insert = table.insert } -local awful = require"awful" +local awful = require("awful") -local helpers = require"vicious.helpers" +local helpers = require("vicious.helpers") ``` ### String Quotes