index_shotgun 0.2.0 → 1.0.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 +5 -5
- data/.github/workflows/test.yml +222 -0
- data/.github_changelog_generator +2 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +26 -2
- data/CHANGELOG.md +47 -0
- data/Gemfile +7 -5
- data/README.md +4 -5
- data/ci/build.sh +31 -0
- data/{travis_ci → ci}/database.yml.mysql +3 -1
- data/ci/database.yml.oracle +5 -0
- data/{travis_ci → ci}/database.yml.postgresql +3 -0
- data/{travis_ci → ci}/database.yml.sqlite3 +0 -0
- data/ci/install.sh +47 -0
- data/exe/index_shotgun +1 -1
- data/gemfiles/activerecord_5_0.gemfile +26 -0
- data/gemfiles/activerecord_5_1.gemfile +26 -0
- data/gemfiles/activerecord_5_2.gemfile +26 -0
- data/gemfiles/activerecord_6_0.gemfile +27 -0
- data/gemfiles/activerecord_6_1.gemfile +27 -0
- data/gemfiles/activerecord_7_0.gemfile +29 -0
- data/gemfiles/common.gemfile +15 -0
- data/index_shotgun.gemspec +16 -19
- data/lib/index_shotgun/analyzer.rb +222 -10
- data/lib/index_shotgun/cli.rb +16 -14
- data/lib/index_shotgun/tasks/index_shotgun.rake +3 -1
- data/lib/index_shotgun/version.rb +1 -1
- metadata +67 -43
- data/.hound.yml +0 -2
- data/.rubocop_standard.yml +0 -196
- data/.travis.yml +0 -27
- data/travis_ci/build.sh +0 -14
data/.rubocop_standard.yml
DELETED
@@ -1,196 +0,0 @@
|
|
1
|
-
# via. https://gist.github.com/onk/38bfbd78899d892e0e83
|
2
|
-
|
3
|
-
# target_version:
|
4
|
-
# rubocop v0.31.0
|
5
|
-
|
6
|
-
# 自動生成されるものはチェック対象から除外する
|
7
|
-
AllCops:
|
8
|
-
Exclude:
|
9
|
-
- "vendor/**/*" # rubocop config/default.yml
|
10
|
-
- "db/schema.rb"
|
11
|
-
DisplayCopNames: true
|
12
|
-
|
13
|
-
##################### Style ##################################
|
14
|
-
|
15
|
-
# redirect_to xxx and return のイディオムを維持したい
|
16
|
-
Style/AndOr:
|
17
|
-
EnforcedStyle: conditionals
|
18
|
-
|
19
|
-
# 日本語のコメントを許可する
|
20
|
-
Style/AsciiComments:
|
21
|
-
Enabled: false
|
22
|
-
|
23
|
-
# option 等、明示的にハッシュにした方が分かりやすい場合もある
|
24
|
-
Style/BracesAroundHashParameters:
|
25
|
-
Enabled: false
|
26
|
-
|
27
|
-
# Style/CollectionMethods 自体は無効になっているのだが、
|
28
|
-
# https://github.com/bbatsov/rubocop/issues/1084
|
29
|
-
# https://github.com/bbatsov/rubocop/issues/1334
|
30
|
-
# Performance/Detect がこの設定値を見るので PreferredMethods だけ変更しておく。
|
31
|
-
#
|
32
|
-
# デフォルト値から変えたのは
|
33
|
-
# find -> detect
|
34
|
-
# ActiveRecord の find と間違えやすいため
|
35
|
-
# reduce -> inject
|
36
|
-
# detect, reject, select と並べたときに韻を踏んでいるため。
|
37
|
-
# collect -> map を維持しているのは文字数が圧倒的に少ないため。
|
38
|
-
Style/CollectionMethods:
|
39
|
-
PreferredMethods:
|
40
|
-
detect: "detect"
|
41
|
-
find: "detect"
|
42
|
-
inject: "inject"
|
43
|
-
reduce: "inject"
|
44
|
-
|
45
|
-
# Hash#has_key? は許可したい
|
46
|
-
Style/DeprecatedHashMethods:
|
47
|
-
Enabled: false
|
48
|
-
|
49
|
-
# ドキュメントの無い public class を許可する
|
50
|
-
Style/Documentation:
|
51
|
-
Enabled: false
|
52
|
-
|
53
|
-
# !! のイディオムは積極的に使う
|
54
|
-
Style/DoubleNegation:
|
55
|
-
Enabled: false
|
56
|
-
|
57
|
-
# メソッドチェーンの改行は末尾に . を入れる
|
58
|
-
# REPL に貼り付けた際の暴発を防ぐため
|
59
|
-
Style/DotPosition:
|
60
|
-
EnforcedStyle: trailing
|
61
|
-
|
62
|
-
# 明示的に else で nil を返すのは分かりやすいので許可する
|
63
|
-
Style/EmptyElse:
|
64
|
-
EnforcedStyle: empty
|
65
|
-
|
66
|
-
# いずれかに揃えるのならば `sprintf` や `format` より String#% が好きです
|
67
|
-
Style/FormatString:
|
68
|
-
EnforcedStyle: percent
|
69
|
-
|
70
|
-
# if 文の中に 3 行程度のブロックを書くぐらいは許容した方が現実的
|
71
|
-
Style/GuardClause:
|
72
|
-
MinBodyLength: 5
|
73
|
-
|
74
|
-
# 同じ hash 内で記法を混ぜない
|
75
|
-
# rake タスクの順序の hash は rocket を許可する
|
76
|
-
Style/HashSyntax:
|
77
|
-
EnforcedStyle: ruby19_no_mixed_keys
|
78
|
-
Exclude:
|
79
|
-
- "**/*.rake"
|
80
|
-
- "Rakefile"
|
81
|
-
|
82
|
-
# 条件式の方を意識させたい場合には後置の if/unless を使わない方が分かりやすい
|
83
|
-
Style/IfUnlessModifier:
|
84
|
-
Enabled: false
|
85
|
-
|
86
|
-
# ({ と hash を開始した場合に ( の位置にインデントさせる
|
87
|
-
# そもそも {} が必要ない可能性が高いが Style/BracesAroundHashParameters はチェックしないことにしたので
|
88
|
-
Style/IndentHash:
|
89
|
-
EnforcedStyle: consistent
|
90
|
-
|
91
|
-
# private/protected は一段深くインデントする
|
92
|
-
Style/IndentationConsistency:
|
93
|
-
EnforcedStyle: rails
|
94
|
-
|
95
|
-
# scope 等は複数行でも lambda ではなく ->{} で揃えた方が見た目が綺麗
|
96
|
-
Style/Lambda:
|
97
|
-
Enabled: false
|
98
|
-
|
99
|
-
# 1_000_000 と区切り文字が 2 個以上必要になる場合のみ _ 区切りを必須にする
|
100
|
-
Style/NumericLiterals:
|
101
|
-
MinDigits: 7
|
102
|
-
|
103
|
-
# has_ から始まるメソッドは許可する
|
104
|
-
Style/PredicateName:
|
105
|
-
NamePrefixBlacklist:
|
106
|
-
- "is_"
|
107
|
-
- "have_"
|
108
|
-
NamePrefix:
|
109
|
-
- "is_"
|
110
|
-
- "have_"
|
111
|
-
|
112
|
-
# 特に model 内において、ローカル変数とメソッド呼び出しの区別をつけた方が分かりやすい場合が多い
|
113
|
-
Style/RedundantSelf:
|
114
|
-
Enabled: false
|
115
|
-
|
116
|
-
# 受け取り側で multiple assignment しろというのを明示
|
117
|
-
Style/RedundantReturn:
|
118
|
-
AllowMultipleReturnValues: true
|
119
|
-
|
120
|
-
# fail と使い分ける必要ナシ
|
121
|
-
Style/SignalException:
|
122
|
-
EnforcedStyle: only_raise
|
123
|
-
|
124
|
-
# `||` も align に使うことがあるので追加する
|
125
|
-
Style/SpaceAroundOperators:
|
126
|
-
MultiSpaceAllowedForOperators:
|
127
|
-
- "="
|
128
|
-
- "=>"
|
129
|
-
- "||"
|
130
|
-
|
131
|
-
# * 式展開したい場合に書き換えるのが面倒
|
132
|
-
# * 文章ではダブルクォートよりもシングルクォートの方が頻出する
|
133
|
-
# ことから EnforcedStyle: double_quotes 推奨
|
134
|
-
Style/StringLiterals:
|
135
|
-
EnforcedStyle: double_quotes
|
136
|
-
|
137
|
-
# auto-correct 時に Style/StringLiterals とカニバって無限ループになる (v0.28.0)
|
138
|
-
Style/StringLiteralsInInterpolation:
|
139
|
-
Enabled: false
|
140
|
-
|
141
|
-
# いくらなんでも inject { |a, e| } は短すぎるので分かりやすい名前をつけたい
|
142
|
-
Style/SingleLineBlockParams:
|
143
|
-
Enabled: false
|
144
|
-
|
145
|
-
# * migrate
|
146
|
-
# * jbuilder
|
147
|
-
# * model の association
|
148
|
-
# * controller の callback
|
149
|
-
# 辺りの桁揃えで引っかかるので全体的にチェックしない
|
150
|
-
Style/SingleSpaceBeforeFirstArg:
|
151
|
-
Enabled: false
|
152
|
-
|
153
|
-
# 複数行の場合はケツカンマを入れる
|
154
|
-
Style/TrailingComma:
|
155
|
-
EnforcedStyleForMultiline: comma
|
156
|
-
|
157
|
-
##################### Lint ##################################
|
158
|
-
|
159
|
-
# * 同名のメソッドがある場合にローカル変数に `_` を付ける
|
160
|
-
# * 一時変数として `_` を付ける
|
161
|
-
# というテクニックは頻出する
|
162
|
-
Lint/UnderscorePrefixedVariableName:
|
163
|
-
Enabled: false
|
164
|
-
|
165
|
-
# 子クラスで実装させるつもりのメソッドで引っかかるので
|
166
|
-
Lint/UnusedMethodArgument:
|
167
|
-
Enabled: false
|
168
|
-
|
169
|
-
##################### Metrics ##################################
|
170
|
-
|
171
|
-
# 30 まではギリギリ許せる範囲だった
|
172
|
-
Metrics/AbcSize:
|
173
|
-
Max: 30
|
174
|
-
|
175
|
-
# 6 は強すぎるので緩める
|
176
|
-
Metrics/CyclomaticComplexity:
|
177
|
-
Max: 10
|
178
|
-
|
179
|
-
# * 警告 120文字
|
180
|
-
# * 禁止 160文字
|
181
|
-
# のイメージ
|
182
|
-
Metrics/LineLength:
|
183
|
-
Max: 160
|
184
|
-
Exclude:
|
185
|
-
- "db/migrate/*.rb"
|
186
|
-
|
187
|
-
# 20 行超えるのは migration ファイル以外滅多に無い
|
188
|
-
Metrics/MethodLength:
|
189
|
-
Max: 20
|
190
|
-
Exclude:
|
191
|
-
- "db/migrate/*.rb"
|
192
|
-
|
193
|
-
# 分岐の数。ガード句を多用しているとデフォルト 7 だと厳しい
|
194
|
-
Metrics/PerceivedComplexity:
|
195
|
-
Max: 8
|
196
|
-
|
data/.travis.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.1
|
4
|
-
- 2.2
|
5
|
-
- ruby-head
|
6
|
-
env:
|
7
|
-
- DATABASE=mysql
|
8
|
-
- DATABASE=postgresql
|
9
|
-
- DATABASE=sqlite3
|
10
|
-
before_script:
|
11
|
-
- export CI=true
|
12
|
-
- export CODECLIMATE_REPO_TOKEN=377596024a4c6f3c4c4b9a0cd16add92fb5e7f716663629b5efd080377c0b838
|
13
|
-
before_install: gem install bundler -v 1.10.6
|
14
|
-
bundler_args: --without oracle
|
15
|
-
script: "./travis_ci/build.sh"
|
16
|
-
branches:
|
17
|
-
only:
|
18
|
-
- master
|
19
|
-
notifications:
|
20
|
-
email: false
|
21
|
-
slack:
|
22
|
-
secure: YGQKOd0oz96gfQtyfTLj7N2Riq93oj1lR9X5hf4071Zu9q3wQjLD4a5y39iVAtOpK2Lw3ShM93kcGREZfpThx9jQ0jUd26DWLLFokZvM82l5+hD7PMhLU1Pv/EbW7mTGAw1TR0su98m91A71qJghdZsT/UrP+QN/4zV72I8XiYrkAiKaTLaucEN4Pn2GgSAGV4Hs7eqT7jNBkGbxSOio3MttoYMDz7dBfR3Z8GRk7jSL5z820zejHNPbfbpwZQhtx/rY/KGSHoIRDc7je6Aiebd5wElQFKsh13LFYSbGaYvB2gRdU/ZmyG0YLV+0hUvWYS14QvCUFrCbiKmRf58tTk3Y/FVtBga+Aj11JrAgpvR9qf2y+gC3BwBwBwaElZ2gMmfZOzXPI7P+OATKbVCQOE4PCAIUkfBbaYkg6FJlYwaume5n+ObLhZPZwa8EGaOkrzonKRhU7hMBT6A+aQkwz0wfccErEog8vB/5OYSMquxZtfWywLgUpnyg97SYeC8aaON+/U8edWsYUR+0bBIySNYEAq0algQEo52cLh4qNpLJeb/zRdFX2b+CI1EYPa+rDSygD7NpT+mx5/5leAcxyvp4S3iKxjFEVkoKwIEoLnqbqjarwz2LjJ+l32wZDhmBV5UggpKoieV5KtpkIwOCJ4g6t+aq786oSW+/GWWI9s0=
|
23
|
-
matrix:
|
24
|
-
allow_failures:
|
25
|
-
- rvm: ruby-head
|
26
|
-
cache: bundler
|
27
|
-
sudo: false
|
data/travis_ci/build.sh
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/bin/bash -xe
|
2
|
-
|
3
|
-
cp travis_ci/database.yml.${DATABASE} spec/config/database.yml
|
4
|
-
bundle exec rspec
|
5
|
-
|
6
|
-
bundle exec ./exe/index_shotgun version
|
7
|
-
|
8
|
-
if [ ${DATABASE} = "mysql" ]; then
|
9
|
-
bundle exec ./exe/index_shotgun mysql --database=index_shotgun_test --username=travis
|
10
|
-
elif [ ${DATABASE} = "postgresql" ]; then
|
11
|
-
bundle exec ./exe/index_shotgun postgresql --database=index_shotgun_test --username=postgres
|
12
|
-
elif [ ${DATABASE} = "sqlite3" ]; then
|
13
|
-
bundle exec ./exe/index_shotgun sqlite3 --database=spec/db/index_shotgun_test.db
|
14
|
-
fi
|