rubocop-github 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/STYLEGUIDE.md +25 -0
  3. data/config/default.yml +12 -15
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2deac26f12f0be3a1298967c4c2e039758a6f4b1
4
- data.tar.gz: 644561f2ad8355dd7270e5882e70212dc1337bce
3
+ metadata.gz: 80d199ffcd70d816e6bc8d7cfbc385d8da6104c7
4
+ data.tar.gz: 28cb103afd0a87170f8e389a67678b0a8384d2aa
5
5
  SHA512:
6
- metadata.gz: 6f00919c2d133c2b58de06a6d64659bf5646a5d9f65040683750b132ff4317a43c0394c74b2ee14d13c27fef24183ccfd27d25856ae914964756890ffa8f2342
7
- data.tar.gz: 1f57f3eaee766eeb2fd65b5a1265f53d883564d88a3a6fb925c990ce5fa33af2b30c0d854019c9fd66cb9bc122f75ff3126e2dd08370afc3c4c23d8a53f1d55b
6
+ metadata.gz: 215ecd2cea223b595711365c443a21c0935990f0c83383827b4eb9b92d53a48ed92a0ee3e38f8d1665f1046e1b4114537b91bfdcf7d4d874333944326f3d9c06
7
+ data.tar.gz: c69e5919daa8ebd0abc60d8f0d59fc72b506a908656c2d992ef5b149a3844f964706f59cff955febd685224c3456bfda8814c00e28982c23272780745b70baef
@@ -224,6 +224,31 @@ def multiplex(text, count)
224
224
  end
225
225
  ```
226
226
 
227
+ ## Dynamic Dispatch
228
+
229
+ Avoid calling `send` and its cousins unless you really need it. Metaprogramming can be extremely powerful, but in most cases you can write code that captures your meaning by being explicit:
230
+
231
+ ``` ruby
232
+ # avoid
233
+ unless [:base, :head].include?(base_or_head)
234
+ raise ArgumentError, "base_or_head must be either :base or :head"
235
+ end
236
+
237
+ repository = pull.send("#{base_or_head}_repository")
238
+ branch = pull.send("#{base_or_head}_ref_name")
239
+
240
+ # prefer
241
+ case base_or_head
242
+ when :base
243
+ repository = pull.base_repository
244
+ branch = pull.base_ref_name
245
+ when :head
246
+ repository = pull.head_repository
247
+ branch = pull.head_ref_name
248
+ else
249
+ raise ArgumentError, "base_or_head must be either :base or :head"
250
+ end
251
+ ```
227
252
  ## Exceptions
228
253
 
229
254
  * Don't use exceptions for flow of control.
@@ -9,9 +9,21 @@ Bundler/DuplicatedGem:
9
9
  Bundler/OrderedGems:
10
10
  Enabled: true
11
11
 
12
+ Layout/BlockAlignment:
13
+ Enabled: true
14
+
12
15
  Layout/BlockEndNewline:
13
16
  Enabled: true
14
17
 
18
+ Layout/ConditionPosition:
19
+ Enabled: true
20
+
21
+ Layout/DefEndAlignment:
22
+ Enabled: true
23
+
24
+ Layout/EndAlignment:
25
+ Enabled: false
26
+
15
27
  Layout/EndOfLine:
16
28
  Enabled: true
17
29
 
@@ -70,21 +82,12 @@ Layout/TrailingBlankLines:
70
82
  Layout/TrailingWhitespace:
71
83
  Enabled: true
72
84
 
73
- Lint/BlockAlignment:
74
- Enabled: true
75
-
76
85
  Lint/CircularArgumentReference:
77
86
  Enabled: true
78
87
 
79
- Lint/ConditionPosition:
80
- Enabled: true
81
-
82
88
  Lint/Debugger:
83
89
  Enabled: true
84
90
 
85
- Lint/DefEndAlignment:
86
- Enabled: true
87
-
88
91
  Lint/DeprecatedClassMethods:
89
92
  Enabled: true
90
93
 
@@ -106,9 +109,6 @@ Lint/EmptyEnsure:
106
109
  Lint/EmptyInterpolation:
107
110
  Enabled: true
108
111
 
109
- Lint/EndAlignment:
110
- Enabled: false
111
-
112
112
  Lint/EndInMethod:
113
113
  Enabled: true
114
114
 
@@ -226,9 +226,6 @@ Performance/EndWith:
226
226
  Performance/FlatMap:
227
227
  Enabled: true
228
228
 
229
- Performance/HashEachMethods:
230
- Enabled: true
231
-
232
229
  Performance/LstripRstrip:
233
230
  Enabled: true
234
231
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-01 00:00:00.000000000 Z
11
+ date: 2018-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop