onkcop 0.35.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b645ee64c928d351ee9467cc5a5028d8ce85cad9
4
+ data.tar.gz: 3c97276d61c2476a685dcd84b4fe06e913d2fa66
5
+ SHA512:
6
+ metadata.gz: df4ac97cad343480f729658929f1724d381392efddeb95658cbb566f286d141ffe39d11190710f3329575b5efae3e718db168c64e15b2392dafb77385681181c
7
+ data.tar.gz: b657c2964b794aade9292b14bbf22b142340ee5f55794bebb1d570ee10bcc49d9a74bc07cb5b513f2f2fb4b0af12c29e1cf1d6be7763d7922944b6af1bff77a1
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in onkcop.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Takafumi ONAKA
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # onkcop
2
+
3
+ OnkCop is a RuboCop configration gem.
4
+
5
+ [rubocop のしつけ方 - onk.ninja](http://blog.onk.ninja/2015/10/27/rubocop-getting-started)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem "onkcop"
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ ```sh
18
+ $ bundle
19
+ ```
20
+
21
+ Or install it yourself as:
22
+
23
+ ```sh
24
+ $ gem install onkcop
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ Add the following directive to your `.rubocop.yml`:
30
+
31
+ ```yaml
32
+ inherit_gem:
33
+ onkcop: "config/rubocop.yml"
34
+ ```
35
+
36
+ ```sh
37
+ bundle exec rubocop <options...>
38
+ ```
39
+
40
+ ## Development
41
+
42
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
43
+
44
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
45
+
46
+ ## Contributing
47
+
48
+ Bug reports and pull requests are welcome on GitHub at https://github.com/onk/onkcop.
49
+
50
+
51
+ ## License
52
+
53
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "onkcop"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,214 @@
1
+ # target_version:
2
+ # rubocop v0.35.1
3
+
4
+ # 自動生成されるものはチェック対象から除外する
5
+ AllCops:
6
+ Exclude:
7
+ - "vendor/**/*" # rubocop config/default.yml
8
+ - "db/schema.rb"
9
+ DisplayCopNames: true
10
+
11
+ ##################### Style ##################################
12
+
13
+ # redirect_to xxx and return のイディオムを維持したい
14
+ Style/AndOr:
15
+ EnforcedStyle: conditionals
16
+
17
+ # 日本語のコメントを許可する
18
+ Style/AsciiComments:
19
+ Enabled: false
20
+
21
+ # do .. end から更にメソッドチェーンすると見づらいので
22
+ # auto-correct せず、自分で修正する
23
+ # spec 内は見た目が綺麗になるので許可
24
+ Style/BlockDelimiters:
25
+ AutoCorrect: false
26
+ Exclude:
27
+ - "spec/**/*"
28
+
29
+ # option 等、明示的にハッシュにした方が分かりやすい場合もある
30
+ Style/BracesAroundHashParameters:
31
+ Enabled: false
32
+
33
+ # Style/CollectionMethods 自体は無効になっているのだが、
34
+ # https://github.com/bbatsov/rubocop/issues/1084
35
+ # https://github.com/bbatsov/rubocop/issues/1334
36
+ # Performance/Detect がこの設定値を見るので PreferredMethods だけ変更しておく。
37
+ #
38
+ # デフォルト値から変えたのは
39
+ # find -> detect
40
+ # ActiveRecord の find と間違えやすいため
41
+ # reduce -> inject
42
+ # detect, reject, select と並べたときに韻を踏んでいるため。
43
+ # collect -> map を維持しているのは文字数が圧倒的に少ないため。
44
+ Style/CollectionMethods:
45
+ PreferredMethods:
46
+ detect: "detect"
47
+ find: "detect"
48
+ inject: "inject"
49
+ reduce: "inject"
50
+
51
+ # Hash#has_key? は許可したい
52
+ Style/DeprecatedHashMethods:
53
+ Enabled: false
54
+
55
+ # ドキュメントの無い public class を許可する
56
+ Style/Documentation:
57
+ Enabled: false
58
+
59
+ # !! のイディオムは積極的に使う
60
+ Style/DoubleNegation:
61
+ Enabled: false
62
+
63
+ # メソッドチェーンの改行は末尾に . を入れる
64
+ # REPL に貼り付けた際の暴発を防ぐため
65
+ Style/DotPosition:
66
+ EnforcedStyle: trailing
67
+
68
+ # 明示的に else で nil を返すのは分かりやすいので許可する
69
+ Style/EmptyElse:
70
+ EnforcedStyle: empty
71
+
72
+ # 桁揃えが綺麗にならないことが多いので migration は除外
73
+ Style/ExtraSpacing:
74
+ Exclude:
75
+ - "db/migrate/*.rb"
76
+
77
+ # いずれかに揃えるのならば `sprintf` や `format` より String#% が好きです
78
+ Style/FormatString:
79
+ EnforcedStyle: percent
80
+
81
+ # if 文の中に 3 行程度のブロックを書くぐらいは許容した方が現実的
82
+ Style/GuardClause:
83
+ MinBodyLength: 5
84
+
85
+ # rake タスクの順序の hash は rocket を許可する
86
+ Style/HashSyntax:
87
+ Exclude:
88
+ - "**/*.rake"
89
+ - "Rakefile"
90
+
91
+ # 条件式の方を意識させたい場合には後置の if/unless を使わない方が分かりやすい
92
+ Style/IfUnlessModifier:
93
+ Enabled: false
94
+
95
+ # ({ と hash を開始した場合に ( の位置にインデントさせる
96
+ # そもそも {} が必要ない可能性が高いが Style/BracesAroundHashParameters はチェックしないことにしたので
97
+ Style/IndentHash:
98
+ EnforcedStyle: consistent
99
+
100
+ # private/protected は一段深くインデントする
101
+ Style/IndentationConsistency:
102
+ EnforcedStyle: rails
103
+
104
+ # scope 等は複数行でも lambda ではなく ->{} で揃えた方が見た目が綺麗
105
+ Style/Lambda:
106
+ Enabled: false
107
+
108
+ # 1_000_000 と区切り文字が 2 個以上必要になる場合のみ _ 区切りを必須にする
109
+ Style/NumericLiterals:
110
+ MinDigits: 7
111
+
112
+ # 正規表現にマッチさせた時の特殊変数の置き換えは Regex.last_match ではなく
113
+ # 名前付きキャプチャを使って参照したいので auto-correct しない
114
+ Style/PerlBackrefs:
115
+ AutoCorrect: false
116
+
117
+ # has_ から始まるメソッドは許可する
118
+ Style/PredicateName:
119
+ NamePrefixBlacklist:
120
+ - "is_"
121
+ - "have_"
122
+ NamePrefix:
123
+ - "is_"
124
+ - "have_"
125
+
126
+ # 特に model 内において、ローカル変数とメソッド呼び出しの区別をつけた方が分かりやすい場合が多い
127
+ Style/RedundantSelf:
128
+ Enabled: false
129
+
130
+ # 受け取り側で multiple assignment しろというのを明示
131
+ Style/RedundantReturn:
132
+ AllowMultipleReturnValues: true
133
+
134
+ # spec 内は見た目が綺麗になるので許可
135
+ Style/Semicolon:
136
+ Exclude:
137
+ - "spec/**/*"
138
+
139
+ # fail と使い分ける必要ナシ
140
+ Style/SignalException:
141
+ EnforcedStyle: only_raise
142
+
143
+ # `||` も align に使うことがあるので追加する
144
+ Style/SpaceAroundOperators:
145
+ MultiSpaceAllowedForOperators:
146
+ - "="
147
+ - "=>"
148
+ - "||"
149
+
150
+ # * 式展開したい場合に書き換えるのが面倒
151
+ # * 文章ではダブルクォートよりもシングルクォートの方が頻出する
152
+ # ことから EnforcedStyle: double_quotes 推奨
153
+ Style/StringLiterals:
154
+ EnforcedStyle: double_quotes
155
+
156
+ # auto-correct 時に Style/StringLiterals とカニバって無限ループになる (v0.28.0)
157
+ Style/StringLiteralsInInterpolation:
158
+ Enabled: false
159
+
160
+ # いくらなんでも inject { |a, e| } は短すぎるので分かりやすい名前をつけたい
161
+ Style/SingleLineBlockParams:
162
+ Enabled: false
163
+
164
+ # * migrate
165
+ # * jbuilder
166
+ # * model の association
167
+ # * controller の callback
168
+ # 辺りの桁揃えで引っかかるので全体的にチェックしない
169
+ Style/SingleSpaceBeforeFirstArg:
170
+ Enabled: false
171
+
172
+ # 複数行の場合はケツカンマを入れる
173
+ Style/TrailingComma:
174
+ EnforcedStyleForMultiline: comma
175
+
176
+ ##################### Lint ##################################
177
+
178
+ # * 同名のメソッドがある場合にローカル変数に `_` を付ける
179
+ # * 一時変数として `_` を付ける
180
+ # というテクニックは頻出する
181
+ Lint/UnderscorePrefixedVariableName:
182
+ Enabled: false
183
+
184
+ # 子クラスで実装させるつもりのメソッドで引っかかるので
185
+ Lint/UnusedMethodArgument:
186
+ Enabled: false
187
+
188
+ ##################### Metrics ##################################
189
+
190
+ # 30 まではギリギリ許せる範囲だった
191
+ Metrics/AbcSize:
192
+ Max: 30
193
+
194
+ # 6 は強すぎるので緩める
195
+ Metrics/CyclomaticComplexity:
196
+ Max: 10
197
+
198
+ # * 警告 120文字
199
+ # * 禁止 160文字
200
+ # のイメージ
201
+ Metrics/LineLength:
202
+ Max: 160
203
+ Exclude:
204
+ - "db/migrate/*.rb"
205
+
206
+ # 20 行超えるのは migration ファイル以外滅多に無い
207
+ Metrics/MethodLength:
208
+ Max: 20
209
+ Exclude:
210
+ - "db/migrate/*.rb"
211
+
212
+ # 分岐の数。ガード句を多用しているとデフォルト 7 だと厳しい
213
+ Metrics/PerceivedComplexity:
214
+ Max: 8
data/lib/onkcop.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "onkcop/version"
2
+
3
+ module Onkcop
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module Onkcop
2
+ VERSION = "0.35.1.0"
3
+ end
data/onkcop.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'onkcop/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "onkcop"
8
+ spec.version = Onkcop::VERSION
9
+ spec.authors = ["Takafumi ONAKA"]
10
+ spec.email = ["takafumi.onaka@gmail.com"]
11
+
12
+ spec.summary = "OnkCop is a RuboCop configration gem."
13
+ spec.description = "OnkCop is a RuboCop configration gem."
14
+ spec.homepage = "https://github.com/onk/onkcop"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: onkcop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.35.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Takafumi ONAKA
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-12-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: OnkCop is a RuboCop configration gem.
42
+ email:
43
+ - takafumi.onaka@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - bin/console
54
+ - bin/setup
55
+ - config/rubocop.yml
56
+ - lib/onkcop.rb
57
+ - lib/onkcop/version.rb
58
+ - onkcop.gemspec
59
+ homepage: https://github.com/onk/onkcop
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.5.1
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: OnkCop is a RuboCop configration gem.
83
+ test_files: []