ryu39cop 0.49.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1a9f7a960af66f54bffb94dce87406f644147787
4
+ data.tar.gz: 15a224c22306ef40b8a91ec0c4fd1c00a7d05aa9
5
+ SHA512:
6
+ metadata.gz: 739319c5bc506b0df88b05b89c11ddf47253d49b013ea0879937dee3495d853c8396ce27261dc3c8b0532a97bbac293731a554d7d08c174567165cca2d11e18f
7
+ data.tar.gz: ca55589ded5be23072437e8ca308c43782ac21f4789e76d942c41f6fcf77fbaf43f1cc15936a3febbda482631a1351602ea0364f1c2acb61616732c4924c06eb
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 ryu39
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/config/rails.yml ADDED
@@ -0,0 +1,8 @@
1
+ Rails:
2
+ Enabled: true
3
+
4
+ Rails/NotNullColumn:
5
+ Enabled: false
6
+
7
+ Rails/SaveBang:
8
+ Enabled: true
data/config/rspec.yml ADDED
@@ -0,0 +1,22 @@
1
+ require: 'rubocop-rspec'
2
+
3
+ RSpec/DescribedClass:
4
+ EnforcedStyle: explicit
5
+
6
+ RSpec/ExampleLength:
7
+ Max: 10
8
+
9
+ RSpec/ImplicitExpect:
10
+ Enabled: false
11
+
12
+ RSpec/MultipleExpectations:
13
+ Max: 8
14
+
15
+ RSpec/NamedSubject:
16
+ Enabled: false
17
+
18
+ RSpec/NestedGroups:
19
+ Max: 4
20
+
21
+ RSpec/RepeatedExample:
22
+ Enabled: false
@@ -0,0 +1,267 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'bin/bundle'
4
+ - 'bin/rails'
5
+ - 'bin/rake'
6
+ - 'bin/setup'
7
+ - 'bin/spring'
8
+ - 'bin/update'
9
+ - 'config.ru'
10
+ - 'vendor/**/*'
11
+ - 'db/schema.rb'
12
+ - 'node_modules/**/*'
13
+ DisplayCopNames: true
14
+
15
+ ## Layout cops
16
+ # https://rubocop.readthedocs.io/en/latest/cops_layout/
17
+
18
+ # 自動生成ファイルは除外
19
+ Layout/ExtraSpacing:
20
+ Exclude:
21
+ - 'db/migrate/*.rb'
22
+
23
+ # 設定が面倒。各自に任せる。
24
+ Layout/IndentHeredoc:
25
+ Enabled: false
26
+
27
+ # 状況に応じて使い分けてよい
28
+ Layout/MultilineAssignmentLayout:
29
+ Enabled: false
30
+
31
+ # このスタイルが好きなため。
32
+ Layout/MultilineMethodCallIndentation:
33
+ EnforcedStyle: indented_relative_to_receiver
34
+
35
+ ## Lint cops
36
+ # https://rubocop.readthedocs.io/en/latest/cops_lint/
37
+
38
+ # expect { subject }.to change { Hoge.count }.by(1) がoffenseと見なされてしまうため。
39
+ # これは公式ドキュメントで示されている書き方なので、例外としたい。
40
+ Lint/AmbiguousBlockAssociation:
41
+ Exclude:
42
+ - 'spec/**/*.rb'
43
+
44
+ # 下記のSafe Assignmentもやはり == と誤解を発生させる可能性があるため禁止する。
45
+ # if (val = do_something)
46
+ # puts val
47
+ # end
48
+ Lint/AssignmentInCondition:
49
+ AllowSafeAssignment: false
50
+
51
+ # 何もしないというwhen節が定義できた方が、表現の幅が広がるはず。
52
+ # case val
53
+ # when 0
54
+ # # nothing to do
55
+ # when 1
56
+ # do_something
57
+ # else
58
+ # raise 'unexpected'
59
+ # end
60
+ Lint/EmptyWhen:
61
+ Enabled: false
62
+
63
+ # StandardErrorが自然
64
+ Lint/InheritException:
65
+ EnforcedStyle: standard_error
66
+
67
+ # キーワード引数の先頭に「_」をつけてしまうと、呼び出し側で「_」をつけて呼ばないとキーが存在せずエラーになってしまうため。
68
+ Lint/UnusedMethodArgument:
69
+ AllowUnusedKeywordArguments: true
70
+
71
+ ## Metrics
72
+ # https://rubocop.readthedocs.io/en/latest/cops_metrics/
73
+
74
+ Metrics/AbcSize:
75
+ Max: 20
76
+
77
+ # 巨大Blockが前提のファイルは除外。
78
+ Metrics/BlockLength:
79
+ Exclude:
80
+ - 'Rakefile'
81
+ - '**/*.rake'
82
+ - 'spec/**/*.rb'
83
+ - 'Gemfile'
84
+ - 'Guardfile'
85
+ - 'config/application.rb'
86
+ - 'config/environments/*.rb'
87
+ - 'config/routes.rb'
88
+ - 'config/routes/**/*.rb'
89
+ - 'db/schema.rb'
90
+ - '*.gemspec'
91
+
92
+ Metrics/CyclomaticComplexity:
93
+ Max: 10
94
+
95
+ # 多くのRubyコーディング規約では「80」か「100」が主流な値であった。
96
+ # 「80」だと厳しすぎるので、「100」に設定する。
97
+ # 自動生成ファイルは除外
98
+ Metrics/LineLength:
99
+ Max: 100
100
+
101
+ Metrics/MethodLength:
102
+ Max: 20
103
+ Exclude:
104
+ - 'db/migrate/*.rb'
105
+
106
+ # キーワード引数は複雑さをほとんどあげないと思っているので、除外。
107
+ Metrics/ParameterLists:
108
+ CountKeywordArgs: false
109
+
110
+ Metrics/PerceivedComplexity:
111
+ Max: 8
112
+
113
+ ## Performance
114
+ # https://rubocop.readthedocs.io/en/latest/cops_performance/
115
+
116
+ # nothing to customize
117
+
118
+ ## Security
119
+ # https://rubocop.readthedocs.io/en/latest/cops_security/
120
+
121
+ Security/YAMLLoad:
122
+ Enabled: false
123
+
124
+ ## Style
125
+ # https://rubocop.readthedocs.io/en/latest/cops_style/
126
+
127
+ Style/Alias:
128
+ EnforcedStyle: prefer_alias_method
129
+
130
+ # redirect_to xxx and return を使いたい
131
+ Style/AndOr:
132
+ EnforcedStyle: conditionals
133
+
134
+ Style/AsciiComments:
135
+ Enabled: false
136
+
137
+ # specのletは {} で統一した方が見やすいため除外。
138
+ Style/BlockDelimiters:
139
+ AutoCorrect: false
140
+ Exclude:
141
+ - 'spec/**/*'
142
+
143
+ Style/BracesAroundHashParameters:
144
+ Enabled: false
145
+
146
+ # class A::Bと書いてインデントを減らして定義した方が読みやすいケースも結構ある。
147
+ # 特にauto_loadingが効くRailsでは、使ってもよいはず。
148
+ Style/ClassAndModuleChildren:
149
+ Enabled: false
150
+
151
+ Style/ClassVars:
152
+ Enabled: true
153
+
154
+ Style/CollectionMethods:
155
+ PreferredMethods:
156
+ detect: 'detect'
157
+ find: 'detect'
158
+ inject: 'inject'
159
+ reduce: 'inject'
160
+
161
+ Style/ConstantName:
162
+ Enabled: true
163
+
164
+ # めんどくさい
165
+ Style/Documentation:
166
+ Enabled: false
167
+
168
+ Style/EmptyMethod:
169
+ EnforcedStyle: expanded
170
+
171
+ Style/For:
172
+ Enabled: true
173
+
174
+ Style/GuardClause:
175
+ MinBodyLength: 5
176
+
177
+ Style/HashSyntax:
178
+ Exclude:
179
+ - '**/*.rake'
180
+ - 'Rakefile'
181
+
182
+ # 2つの条件の意味合いの違いで、どちらも使いたいケースがあると思う。
183
+ Style/IfInsideElse:
184
+ Enabled: false
185
+
186
+ # 後置if/unlessが合わないケースもある。
187
+ Style/IfUnlessModifier:
188
+ Enabled: false
189
+
190
+ Style/IfUnlessModifierOfIfUnless:
191
+ Enabled: true
192
+
193
+ Style/Lambda:
194
+ EnforcedStyle: literal
195
+
196
+ Style/MethodCalledOnDoEndBlock:
197
+ Enabled: true
198
+
199
+ # RSpec の matcher を誤検知するため
200
+ # expect(array).to include('a', 'b')
201
+ Style/MixinGrouping:
202
+ Exclude:
203
+ - 'spec/**/*'
204
+
205
+ Style/NumericLiterals:
206
+ MinDigits: 7
207
+
208
+ Style/NumericPredicate:
209
+ Enabled: false
210
+
211
+ Style/PercentLiteralDelimiters:
212
+ PreferredDelimiters:
213
+ default: ()
214
+ '%w': '()'
215
+ '%W': '()'
216
+ '%i': '()'
217
+ '%I': '()'
218
+ '%r': '{}'
219
+
220
+ Style/PerlBackrefs:
221
+ AutoCorrect: false
222
+
223
+ Style/PredicateName:
224
+ NamePrefixBlacklist:
225
+ - 'is_'
226
+ - 'have_'
227
+ NamePrefix:
228
+ - 'is_'
229
+ - 'have_'
230
+
231
+ Style/PreferredHashMethods:
232
+ EnforcedStyle: verbose
233
+
234
+ Style/RedundantReturn:
235
+ AllowMultipleReturnValues: true
236
+
237
+ Style/RedundantSelf:
238
+ Enabled: false
239
+
240
+ Style/SafeNavigation:
241
+ Enabled: false
242
+
243
+ Style/Semicolon:
244
+ Exclude:
245
+ - "spec/**/*"
246
+
247
+ Style/StringMethods:
248
+ Enabled: true
249
+
250
+ Style/SymbolArray:
251
+ Enabled: false
252
+
253
+ Style/TernaryParentheses:
254
+ EnforcedStyle: require_parentheses_when_complex
255
+
256
+ Style/TrailingCommaInLiteral:
257
+ EnforcedStyleForMultiline: comma
258
+
259
+ Style/WordArray:
260
+ Enabled: false
261
+
262
+ Style/ZeroLengthPredicate:
263
+ Enabled: false
264
+
265
+ # 機能的に近いものをまとめる方が、必要Gem一覧を見たときにわかりやすいと思うため。
266
+ Bundler/OrderedGems:
267
+ Enabled: false
data/exe/ryu39cop ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
4
+
5
+ # Exit cleanly from an early interrupt
6
+ Signal.trap('INT') { exit 1 }
7
+
8
+ require 'ryu39cop'
9
+
10
+ Ryu39Cop::CLI.start(ARGV)
data/lib/ryu39cop.rb ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ryu39cop/version'
4
+ require 'ryu39cop/cli'
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+
5
+ module Ryu39Cop
6
+ class CLI
7
+ def self.start(args)
8
+ action_name = retrieve_command_name(args)
9
+ unless action_name
10
+ print_help
11
+ exit
12
+ end
13
+
14
+ instance = self.new
15
+ if instance.public_methods(false).include?(action_name.to_sym)
16
+ instance.__send__(action_name, args)
17
+ exit
18
+ end
19
+
20
+ puts "Could not find command #{action_name}."
21
+ print_help
22
+ exit(1)
23
+ rescue => e
24
+ puts e.message
25
+ exit(1)
26
+ end
27
+
28
+ def self.retrieve_command_name(args)
29
+ return nil if args.empty?
30
+ meth = args.first.to_s
31
+ args.shift if meth !~ /^\-/
32
+ end
33
+
34
+ def self.print_help
35
+ puts 'ryu39cop commands:'
36
+ puts ' init - Setup .rubocop.yml'
37
+ end
38
+
39
+ CONFIG_FILE_NAME = '.rubocop.yml'.freeze
40
+
41
+ def init(args)
42
+ raise 'usage: ryu39cop init' unless args.empty?
43
+ template_path = File.expand_path('../../templates', __dir__)
44
+ puts "#{File.exist?(CONFIG_FILE_NAME) ? 'overwrite' : 'create'} #{CONFIG_FILE_NAME}"
45
+ FileUtils.copy_file(File.join(template_path, CONFIG_FILE_NAME), CONFIG_FILE_NAME)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ryu39Cop
4
+ VERSION = '0.49.1.0'.freeze
5
+ end
@@ -0,0 +1,14 @@
1
+ #require: 'rubocop-rspec'
2
+
3
+ inherit_gem:
4
+ ryu39cop:
5
+ - 'config/rubocop.yml'
6
+ #- 'config/rails.yml'
7
+ #- 'config/rspec.yml'
8
+
9
+ #inherit_from:
10
+ # - .rubocop_todo.yml
11
+
12
+ AllCops:
13
+ TargetRubyVersion: 2.4
14
+ #TargetRailsVersion: 5.0
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ryu39cop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.49.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ryu39
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-06-10 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.49.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.49.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop-rspec
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: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.15.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.15.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '12.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '12.0'
69
+ description: ryu39's rubocop configuration
70
+ email:
71
+ - dev.ryu39@gmail.com
72
+ executables:
73
+ - ryu39cop
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - LICENSE.txt
78
+ - config/rails.yml
79
+ - config/rspec.yml
80
+ - config/rubocop.yml
81
+ - exe/ryu39cop
82
+ - lib/ryu39cop.rb
83
+ - lib/ryu39cop/cli.rb
84
+ - lib/ryu39cop/version.rb
85
+ - templates/.rubocop.yml
86
+ homepage: https://github.com/ryu39/ryu39cop
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.6.11
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: ryu39's rubocop configuration
110
+ test_files: []