catalcop 0.2.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e1d323581eec1727538d2c47bf7237ca40e1db2117fd8ce235fccfcbde7dff6f
4
+ data.tar.gz: 249ed67342e2d32979030f4a39887a3048846216cc13a737672797f90bfa1b9a
5
+ SHA512:
6
+ metadata.gz: b3a13842d69246c302f92e062f248ff10d452ee031af7ea1c3fc43445e91e502ac8696f49c689148a7c7b5e2f666e3daaac8c87c70b7115a0f13f2105ac40a73
7
+ data.tar.gz: 1ce004217923e7b34cac8ad18e403ece794c9d98369a30243832abebc93943e558284ea4538a88e44c207177686ea31ca752573202a008f800c8223ff195f3d0
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1 @@
1
+ inherit_from: ./config/rubocop.yml
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in catalcop.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 kindaidai
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.
@@ -0,0 +1,39 @@
1
+ # Catalcop
2
+
3
+ Catalcop provides recommended RuboCop configuration for use on Catal Ruby projects.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'catalcop', github: 'catal/catalcop'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ ## Usage
18
+
19
+ ##### Gemfile
20
+
21
+ ```Gemfile
22
+ group :development do
23
+ gem "rubocop"
24
+ gem "rubocop-performance", require: false
25
+ gem "rubocop-rails", require: false
26
+ gem "rubocop-rspec", require: false
27
+ end
28
+ ```
29
+
30
+ ##### .rubocop.yml
31
+
32
+ ```yml
33
+ inherit_gem:
34
+ catalcop: config/rubocop.yml
35
+ ```
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "catalcop"
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(__FILE__)
@@ -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,28 @@
1
+ require_relative 'lib/catalcop/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "catalcop"
5
+ spec.version = Catalcop::VERSION
6
+ spec.authors = ["geeknees"]
7
+ spec.email = ["kawasaki@catal.jp"]
8
+
9
+ spec.summary = %q{RuboCop Catal}
10
+ spec.description = %q{Code style checking for Catal Ruby repositories.}
11
+ spec.homepage = "https://github.com/Catal/catalcop"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "rubocop"
25
+ spec.add_dependency "rubocop-performance"
26
+ spec.add_dependency "rubocop-rails"
27
+ spec.add_dependency "rubocop-rspec"
28
+ end
@@ -0,0 +1,232 @@
1
+ # 自動生成されるものはチェック対象から除外する
2
+ AllCops:
3
+ Exclude:
4
+ - "vendor/**/*" # rubocop config/default.yml
5
+ - "db/fixtures/*.rb"
6
+ - "db/schema.rb"
7
+ - "db/seeds.rb"
8
+ - "db/migrate/*.rb"
9
+ - "bin/*"
10
+ - "config/application.rb"
11
+ - "config/initializers/*.rb"
12
+ - "Guardfile"
13
+ - "app/helpers/rating_helper.rb"
14
+ - "node_modules/**/*"
15
+ - "lib/tasks/*"
16
+ DisplayCopNames: true
17
+ DisplayStyleGuide: true
18
+ ExtraDetails: true
19
+ NewCops: enable
20
+ StyleGuideBaseURL: https://github.com/rubocop-hq/ruby-style-guide/blob/master/README.adoc
21
+
22
+ require:
23
+ - rubocop-performance
24
+ - rubocop-rails
25
+ - rubocop-rspec
26
+
27
+ ##################### Style ##################################
28
+
29
+ # redirect_to xxx and return のイディオムを維持したい
30
+ Style/AndOr:
31
+ EnforcedStyle: conditionals
32
+
33
+ # 日本語のコメントを許可する
34
+ Style/AsciiComments:
35
+ Enabled: false
36
+
37
+ # ドキュメントの無い public class を許可する
38
+ Style/Documentation:
39
+ Enabled: false
40
+
41
+ # !! のイディオムは積極的に使う
42
+ Style/DoubleNegation:
43
+ Enabled: false
44
+
45
+ # 明示的に else で nil を返すのは分かりやすいので許可する
46
+ Style/EmptyElse:
47
+ EnforcedStyle: empty
48
+
49
+ # GuardClauseを強制しない
50
+ # https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
51
+ Style/GuardClause:
52
+ Enabled: false
53
+
54
+ Style/HashEachMethods:
55
+ Enabled: true
56
+
57
+ Style/HashTransformValues:
58
+ Enabled: true
59
+
60
+ # rake タスクの順序の hash は rocket を許可する
61
+ Style/HashSyntax:
62
+ Exclude:
63
+ - "**/*.rake"
64
+ - "Rakefile"
65
+
66
+ # 条件式の方を意識させたい場合には後置の if/unless を使わない方が分かりやすい
67
+ Style/IfUnlessModifier:
68
+ Enabled: false
69
+
70
+ # scope 等は複数行でも lambda ではなく ->{} で揃えた方が見た目が綺麗
71
+ Style/Lambda:
72
+ Enabled: false
73
+
74
+ Style/MixinUsage:
75
+ Exclude:
76
+ - "lib/task_logger.rb"
77
+
78
+ # 1_000_000 と区切り文字が 2 個以上必要になる場合のみ _ 区切りを必須にする
79
+ Style/NumericLiterals:
80
+ MinDigits: 7
81
+
82
+ # 正規表現にマッチさせた時の特殊変数の置き換えは Regex.last_match ではなく
83
+ # 名前付きキャプチャを使って参照したいので auto-correct しない
84
+ Style/PerlBackrefs:
85
+ AutoCorrect: false
86
+
87
+ # 特に model 内において、ローカル変数とメソッド呼び出しの区別をつけた方が分かりやすい場合が多い
88
+ Style/RedundantSelf:
89
+ Enabled: false
90
+
91
+ # 受け取り側で multiple assignment しろというのを明示
92
+ Style/RedundantReturn:
93
+ AllowMultipleReturnValues: true
94
+
95
+ # spec 内は見た目が綺麗になるので許可
96
+ Style/Semicolon:
97
+ Exclude:
98
+ - "spec/**/*"
99
+
100
+ # fail と使い分ける必要ナシ
101
+ Style/SignalException:
102
+ EnforcedStyle: only_raise
103
+
104
+ # いくらなんでも inject { |a, e| } は短すぎるので分かりやすい名前をつけたい
105
+ Style/SingleLineBlockParams:
106
+ Enabled: false
107
+
108
+ # rails g spec:*** コマンド経由だと、double quoteになる
109
+ Style/StringLiterals:
110
+ Exclude:
111
+ - "spec/**/*"
112
+
113
+ # 複数行の場合はケツカンマを入れる
114
+ Style/TrailingCommaInArguments:
115
+ EnforcedStyleForMultiline: comma
116
+
117
+ Style/TrailingCommaInArrayLiteral:
118
+ EnforcedStyleForMultiline: comma
119
+
120
+ Style/TrailingCommaInHashLiteral:
121
+ EnforcedStyleForMultiline: comma
122
+
123
+ # 複数行の場合は { ... } ではなく do ... end を使うべきというチェック項目
124
+ Style/BlockDelimiters:
125
+ Enabled: false
126
+
127
+ # raise Exception.new(msg)形式を有効とする
128
+ Style/RaiseArgs:
129
+ EnforcedStyle: compact
130
+
131
+ # Checks if there is a magic comment to enforce string literals
132
+ Style/FrozenStringLiteralComment:
133
+ Enabled: false
134
+
135
+ Style/NumericPredicate:
136
+ Enabled: false
137
+
138
+ ##################### Layout ##################################
139
+
140
+ # ({ と hash を開始した場合に ( の位置にインデントさせる
141
+ # そもそも {} が必要ない可能性が高いが Style/BracesAroundHashParameters はチェックしないことにしたので
142
+ Layout/FirstHashElementIndentation:
143
+ EnforcedStyle: consistent
144
+
145
+ # private/protected は一段深くインデントする
146
+ Layout/IndentationConsistency:
147
+ EnforcedStyle: indented_internal_methods
148
+
149
+ # `||` も align に使うことがあるので追加する
150
+ Layout/SpaceAroundOperators:
151
+ AllowForAlignment:
152
+ - "="
153
+ - "=>"
154
+ - "||"
155
+
156
+ # * migrate
157
+ # * jbuilder
158
+ # * model の association
159
+ # * controller の callback
160
+ # 辺りの桁揃えで引っかかるので全体的にチェックしない
161
+ Layout/SpaceBeforeFirstArg:
162
+ Enabled: false
163
+
164
+ # * 警告 120文字
165
+ # * 禁止 160文字
166
+ # のイメージ
167
+ Layout/LineLength:
168
+ Enabled: true
169
+ Max: 160
170
+ Exclude:
171
+ - "spec/*/*.rb"
172
+
173
+ ##################### Naming ##################################
174
+
175
+ # has_ から始まるメソッドは許可する
176
+ Naming/PredicateName:
177
+ ForbiddenPrefixes:
178
+ - "is_"
179
+ - "have_"
180
+ NamePrefix:
181
+ - "is_"
182
+ - "have_"
183
+
184
+ ##################### Lint ##################################
185
+
186
+ Lint/RescueException:
187
+ Exclude:
188
+ - "lib/task_logger.rb"
189
+
190
+ # * 同名のメソッドがある場合にローカル変数に `_` を付ける
191
+ # * 一時変数として `_` を付ける
192
+ # というテクニックは頻出する
193
+ Lint/UnderscorePrefixedVariableName:
194
+ Enabled: false
195
+
196
+ ##################### Metrics ##################################
197
+
198
+ Metrics/AbcSize:
199
+ Enabled: true
200
+ Max: 30
201
+
202
+ # 6 は強すぎるので緩める
203
+ Metrics/CyclomaticComplexity:
204
+ Enabled: true
205
+ Max: 10
206
+
207
+ # 分岐の数。ガード句を多用しているとデフォルト 7 だと厳しい
208
+ Metrics/PerceivedComplexity:
209
+ Enabled: true
210
+ Max: 10
211
+
212
+ Metrics/ClassLength:
213
+ Max: 300
214
+
215
+ Metrics/MethodLength:
216
+ Enabled: true
217
+ Max: 20
218
+
219
+ Metrics/BlockLength:
220
+ Enabled: true
221
+
222
+ # デフォルト値を明示しないとHoundに怒られる
223
+ Rails/FilePath:
224
+ EnforcedStyle: slashes
225
+
226
+ ##################### RSpec ##################################
227
+ # ネストの最大数(falseにしてもいいくらいだが、念の為)
228
+ RSpec/NestedGroups:
229
+ Max: 4
230
+
231
+ RSpec/MessageChain:
232
+ Enabled: false
@@ -0,0 +1,6 @@
1
+ require "catalcop/version"
2
+
3
+ module Catalcop
4
+ class Error < StandardError; end
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,3 @@
1
+ module Catalcop
2
+ VERSION = "0.2.0"
3
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: catalcop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - geeknees
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop-performance
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Code style checking for Catal Ruby repositories.
70
+ email:
71
+ - kawasaki@catal.jp
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rubocop.yml"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - catalcop.gemspec
85
+ - config/rubocop.yml
86
+ - lib/catalcop.rb
87
+ - lib/catalcop/version.rb
88
+ homepage: https://github.com/Catal/catalcop
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 2.3.0
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubygems_version: 3.0.3
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: RuboCop Catal
111
+ test_files: []