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 +4 -4
- data/README.md +23 -4
- data/config/rspec.yml +4 -0
- data/config/rubocop.yml +41 -0
- data/lib/retrieva/cop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cccf221159a0171982ba08358c49c55bd2ea8eb
|
4
|
+
data.tar.gz: 35cb868289422a9d1eefdb75523f4c073352c5dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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
|
data/lib/retrieva/cop/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|