retrieva-cop 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e818a721e09f9a3139b1fc097f794682a71e70e
4
- data.tar.gz: 86125f726503eac7723be849012ae0ac5ff031a6
3
+ metadata.gz: 6cccf221159a0171982ba08358c49c55bd2ea8eb
4
+ data.tar.gz: 35cb868289422a9d1eefdb75523f4c073352c5dd
5
5
  SHA512:
6
- metadata.gz: 0dd2acef70b76353a1563f8b4a12d6e7b5118502db45d8d56b1a50f0c2d747604e05437eb9b91a95ed317eca47784b8675fd47efaf64aca23651204028001067
7
- data.tar.gz: a27c16d72e9cea119b6d9ddbefc321310e355120cf7a117a933c365d5383a5372854f9f9339233b2ab163f142c5b73b6882a9a9cd0f71731818510ed16dfdaf5
6
+ metadata.gz: ad45240deacf892f73379c14378344e600014732d555cf40dd4add1f1dd09d8f9876a8e5fb43ce4ff3446537375a256620c6c057696bec405c93161e978cf5bd
7
+ data.tar.gz: f06f4e198906909712714323a272fb09e91229861c702892c475cf5f15efb115dcbaf22a838eefdfdec1056e69c86f71cfe38e44aacb3495e85bd38c10c546c6
data/README.md CHANGED
@@ -3,10 +3,6 @@
3
3
  Retrieva::Cop is a RuboCop configuration gem for Retrieva, inc.
4
4
  Highly inspiered by [onkcop](https://github.com/onk/onkcop/) and [deka_eiwakun](https://github.com/esminc/deka_eiwakun/)
5
5
 
6
- ## Usage
7
-
8
- TODO: Write usage instructions here
9
-
10
6
  ## Installation
11
7
 
12
8
  Add this line to your application's Gemfile:
@@ -17,6 +13,29 @@ group :development do
17
13
  end
18
14
  ```
19
15
 
16
+ ## Usage
17
+
18
+ Add the following directive to your `.rubocop.yml`:
19
+
20
+ ```yaml
21
+ inherit_gem:
22
+ retrieva-cop:
23
+ - "config/rubocop.yml"
24
+ # comment unless use rails cops
25
+ - "config/rails.yml"
26
+ # comment unless use rspec cops
27
+ - "config/rspec.yml"
28
+
29
+ AllCops:
30
+ TargetRubyVersion: 2.4
31
+ # comment unless use rails cops
32
+ TargetRailsVersion: 5.1
33
+ ```
34
+
35
+ ```
36
+ bundle exec rubocop <options...>
37
+ ```
38
+
20
39
  ## Contributing
21
40
 
22
41
  Bug reports and pull requests are welcome on GitHub at https://github.com/retrieva/retrieva-cop.
data/config/rspec.yml CHANGED
@@ -1,5 +1,9 @@
1
1
  require: "rubocop-rspec"
2
2
 
3
+ # feature spec で scenario を使っても良い
4
+ Capybara/FeatureMethods:
5
+ Enabled: false
6
+
3
7
  # 短い subject は一行で書いて良い
4
8
  RSpec/EmptyLineAfterSubject:
5
9
  Enabled: false
data/config/rubocop.yml CHANGED
@@ -6,6 +6,10 @@ AllCops:
6
6
  - "vendor/**/*" # rubocop config/default.yml
7
7
  - "db/schema.rb"
8
8
  - "node_modules/**/*"
9
+ - "config.ru"
10
+ - "config/puma.rb"
11
+ - "config/unicorn.rb"
12
+ - "Capfile"
9
13
  DisplayCopNames: true
10
14
 
11
15
  #################### Layout ################################
@@ -24,6 +28,16 @@ Layout/ExtraSpacing:
24
28
  Layout/MultilineMethodCallIndentation:
25
29
  EnforcedStyle: indented_relative_to_receiver
26
30
 
31
+ # Rails の生成するファイルに存在するので除外
32
+ Layout/SpaceInsideBrackets:
33
+ Exclude:
34
+ - "config/environments/*"
35
+
36
+ # Rails の生成するファイルに存在するので除外
37
+ Layout/SpaceInsidePercentLiteralDelimiters:
38
+ Exclude:
39
+ - "config/initializers/*"
40
+
27
41
  #################### Lint ##################################
28
42
 
29
43
  # Style/EmptyCaseCondition と同じく網羅の表現力が empty when を認めた方が高いし、
@@ -84,6 +98,11 @@ Metrics/MethodLength:
84
98
  Style/AsciiComments:
85
99
  Enabled: false
86
100
 
101
+ # RSpec の生成するファイルに存在するので除外
102
+ Style/BlockComments:
103
+ Exclude:
104
+ - "spec/spec_helper.rb"
105
+
87
106
  # do .. end から更にメソッドチェーンすると見づらいので
88
107
  # auto-correct せず、自分で修正する
89
108
  # spec 内は見た目が綺麗になるので許可
@@ -105,6 +124,11 @@ Style/Documentation:
105
124
  Style/DoubleNegation:
106
125
  Enabled: false
107
126
 
127
+ # 空メソッドの場合だけ1行で書かなければいけない理由が無い
128
+ # 「セミコロンは使わない」に寄せた方がルールがシンプル
129
+ Style/EmptyMethod:
130
+ EnforcedStyle: expanded
131
+
108
132
  # まだ対応するには早い
109
133
  Style/FrozenStringLiteralComment:
110
134
  Enabled: false
@@ -115,10 +139,19 @@ Style/HashSyntax:
115
139
  - "**/*.rake"
116
140
  - "Rakefile"
117
141
 
142
+ # 条件式の方を意識させたい場合には後置の if/unless を使わない方が分かりやすい
143
+ Style/IfUnlessModifier:
144
+ Enabled: false
145
+
118
146
  # 特に model 内において、ローカル変数とメソッド呼び出しの区別をつけた方が分かりやすい場合が多い
119
147
  Style/RedundantSelf:
120
148
  Enabled: false
121
149
 
150
+ # 以下のような rescue はそもそも raise して良いのかチェックするべきなので、AutoCorrect しない
151
+ # something rescue nil
152
+ Style/RescueModifier:
153
+ AutoCorrect: false
154
+
122
155
  # Rubocop は %w[] を押すが、%w() で問題ないとする
123
156
  Style/PercentLiteralDelimiters:
124
157
  PreferredDelimiters:
@@ -137,6 +170,10 @@ Style/NumericLiterals:
137
170
  Style/NumericPredicate:
138
171
  Enabled: false
139
172
 
173
+ # 無理して使うモンじゃない
174
+ Style/SafeNavigation:
175
+ Enabled: false
176
+
140
177
  # spec 内は見た目が綺麗になるので許可
141
178
  Style/Semicolon:
142
179
  Exclude:
@@ -149,6 +186,10 @@ Style/StringLiterals:
149
186
  Exclude:
150
187
  - "db/migrate/*"
151
188
 
189
+ # AutoCorrect すると .to_s するが、実際には .to_s が必要ない場合が多いので、手動で行う
190
+ Style/UnneededInterpolation:
191
+ AutoCorrect: false
192
+
152
193
  # 条件式で arr.size > 0 が使われた時に
153
194
  # if !arr.empty?
154
195
  # else
@@ -1,5 +1,5 @@
1
1
  module Retrieva
2
2
  module Cop
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retrieva-cop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kei Shiratsuchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-06 00:00:00.000000000 Z
11
+ date: 2017-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop