From be071be3cf47660830d062e3faa57e02bc9ef207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Mon, 12 Sep 2016 15:31:40 +0200 Subject: Document our preference for array literals until we enable a Cop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- CONTRIBUTING.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c77dcd96a7d..47359a3afd6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -414,6 +414,19 @@ merge request: [Naming][rss-naming]. Use: - multi-line method chaining style **Option B**: dot `.` on previous line - string literal quoting style **Option A**: single quoted by default + - Array `%` literals: Prefer `[]` as delimiters for all `%` literals since + the `[` and `]` are already used for non-literal arrays, e.g. + + ```ruby + # good + ['a', 'b', 'c'] + %w[one two three] + %i[one two three] + + # bad + %w(one two three) + %i{one two three} + ``` 1. [Rails](https://github.com/bbatsov/rails-style-guide) 1. [Newlines styleguide][newlines-styleguide] 1. [Testing](doc/development/testing.md) -- cgit v1.2.1