fablicop 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82835ebf9aa5be49c56d4527f65ef58ad13c37dc
4
- data.tar.gz: ef4aee8ea6f4ac0bf7692bd7d6fbc4e3e04f82ec
3
+ metadata.gz: 27ae07db56461d154046bf70225e52aba18cc048
4
+ data.tar.gz: ee414d5b1e300682233ff6399ec6d9bb10a0da59
5
5
  SHA512:
6
- metadata.gz: 6caeac976785646313fdfe3c01800f6c25f5cb5abbbb06b0619a765da6f89483fc8016f87d227c1589377553ad0bccda102521d802e488fc0c16ab6cb07c05b7
7
- data.tar.gz: 24343724911deb2ef20e434e49e9d09309ffb236a8dc6b6cdaf6092b68b09e551e111fada93fd1e5feb47e229b76e705c70986501996ab98bc5944729ecb0547
6
+ metadata.gz: f4de17ffc68e508ada6aa202d6005e64e57a32a6dc10baab1f8fbdffcd4ec0d14288682cb1b05b06bb01605a625f3c61430babb99aa8c8aaa5a5abd4b3a08bbb
7
+ data.tar.gz: dbc54195979ec4fbd0205213782d1502570012e883212ec28b1f5fd5c136c39b1f51d0609c3115b5c9e2435162c97994de4478b7ebf4ee3ee899ca4586118111
data/README.md CHANGED
@@ -7,7 +7,7 @@ fablicop is a RuboCop configration gem.
7
7
  Setup .rubocop.yml
8
8
 
9
9
  ```sh
10
- bundle exec onkcp init
10
+ bundle exec fablicop init
11
11
  ```
12
12
 
13
13
  `init` generate the following directive to your `.rubocop.yml`:
@@ -43,7 +43,7 @@ end
43
43
 
44
44
  ## Contributing
45
45
 
46
- Bug reports and pull requests are welcome on GitHub at https://github.com/onk/fablicop.
46
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Fablic/fablicop.
47
47
 
48
48
 
49
49
  ## License
@@ -0,0 +1,103 @@
1
+ # 自動生成されるものやテストデータはチェック対象から除外する
2
+ AllCops:
3
+ Exclude:
4
+ - "vendor/**/*" # rubocop config/default.yml
5
+ - "db/schema.rb"
6
+ - "db/migrate/*"
7
+ - "db/fixtures/**/*"
8
+ - "test/factories/**/*"
9
+ - "spec/factories/**/*"
10
+ DisplayCopNames: true
11
+ TargetRubyVersion: 2.3
12
+ Rails:
13
+ Enabled: true
14
+ # rails >= 5 の設定のため
15
+ Rails/HttpPositionalArguments:
16
+ Enabled: false
17
+
18
+ ##################### Style ##################################
19
+
20
+ # 日本語のコメントを許可する
21
+ Style/AsciiComments:
22
+ Enabled: false
23
+
24
+ # 複数行の場合はケツカンマを入れる
25
+ Style/TrailingCommaInLiteral:
26
+ EnforcedStyleForMultiline: comma
27
+ Style/TrailingCommaInArguments:
28
+ EnforcedStyleForMultiline: comma
29
+
30
+ # class先頭のコメントを省略する
31
+ Style/Documentation:
32
+ Enabled: false
33
+
34
+ # selfは省略しない
35
+ Style/RedundantSelf:
36
+ Enabled: false
37
+
38
+ # 以下の2つのあわせ技で、こういうのを許可
39
+ # xs.select {
40
+ # f x
41
+ # }.map { |x|
42
+ # f x
43
+ # f x
44
+ # }.compact
45
+ # Rubocopの意図としては、おそらく
46
+ # * ブロックのあとにメソッドをチェインされると読みにくい(主観)
47
+ # * ブロックの終わりを`}`ではなく`end`にすることで、defとかifとかと終了を揃える
48
+ # だと思うけど、むしろ一旦変数に入れて改めてメソッド適用する方がかえって読みにくいと思うし(主観)、
49
+ # 返り値を使う場合はブロックの終わりをendにせず}にしないとメソッド結合順序の関係などでやばいので
50
+ # Style/BlockDelimitersとStyle/MultilineBlockChainはよくないと判断。
51
+ #
52
+ # 「返り値を目的とするブロック引数」には{}を、「副作用を目的とするブロック引数」にはdo/endを
53
+ # 使うようにすると、可読性的にもメソッドの結合順序的にも実用上便利。
54
+ # これが正しく運用されてるかどうかはgrammerではなくsemanticの話なので、レビュワーの人間が
55
+ # 見ることになり、それは直感的な気がする (再び主観)
56
+ Style/BlockDelimiters:
57
+ Enabled: false
58
+ Style/MultilineBlockChain:
59
+ Enabled: false
60
+ Style/EmptyMethod:
61
+ Enabled: false
62
+ Style/MultilineMethodCallBraceLayout:
63
+ Enabled: false
64
+ Style/MultilineMethodCallIndentation:
65
+ Enabled: false
66
+
67
+ ##################### Layout ##################################
68
+ # 引数前のスペースは複数許可
69
+ Layout/SpaceBeforeFirstArg:
70
+ Enabled: false
71
+ Layout/SpaceInLambdaLiteral:
72
+ Enabled: false
73
+ Layout/IndentHeredoc:
74
+ Enabled: false
75
+
76
+ ##################### Lint ##################################
77
+
78
+ # 引数前のスペースを許容する
79
+ Lint/ParenthesesAsGroupedExpression:
80
+ Enabled: false
81
+
82
+ ##################### Metrics ##################################
83
+
84
+ # * 警告 120文字
85
+ # * 禁止 160文字
86
+ # のイメージ
87
+ Metrics/LineLength:
88
+ Max: 160
89
+ Exclude:
90
+ - "db/migrate/*.rb"
91
+
92
+ # 20 行超えるのは migration ファイル以外滅多に無い
93
+ Metrics/MethodLength:
94
+ Max: 20
95
+ Exclude:
96
+ - "db/migrate/*.rb"
97
+
98
+ Metrics/BlockLength:
99
+ Max: 100
100
+
101
+ # キーワード引数は引数の数に含めない
102
+ ParameterLists:
103
+ CountKeywordArgs: false
@@ -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 "fablicop"
9
+
10
+ Fablicop::CLI.start(ARGV)
@@ -6,7 +6,7 @@ require 'fablicop/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "fablicop"
8
8
  spec.version = Fablicop::VERSION
9
- spec.authors = ["Tomy"]
9
+ spec.authors = ["tommy"]
10
10
  spec.email = ["kazushige_tominaga@fablic.co.jp"]
11
11
 
12
12
  spec.summary = "fablicop is a RuboCop configration gem. "
@@ -1,3 +1,4 @@
1
+ require "fablicop/cli"
1
2
  require "fablicop/version"
2
3
 
3
4
  module Fablicop
@@ -0,0 +1,43 @@
1
+ require "fileutils"
2
+ module Fablicop
3
+ class CLI
4
+ def self.start(args)
5
+ action_name = retrieve_command_name(args)
6
+ unless action_name
7
+ print_help
8
+ exit
9
+ end
10
+
11
+ instance = self.new
12
+ if instance.public_methods(false).include?(action_name.to_sym)
13
+ instance.__send__(action_name, args)
14
+ exit
15
+ end
16
+
17
+ puts "Could not find command #{action_name}."
18
+ print_help
19
+ exit(1)
20
+ rescue => e
21
+ puts e.message
22
+ exit(1)
23
+ end
24
+
25
+ def self.retrieve_command_name(args)
26
+ meth = args.first.to_s unless args.empty?
27
+ args.shift if meth && (meth !~ /^\-/)
28
+ end
29
+
30
+ def self.print_help
31
+ puts "fablicop commands:"
32
+ puts " init - Setup .rubocop.yml"
33
+ end
34
+
35
+ CONFIG_FILE_NAME = ".rubocop.yml"
36
+ def init(args)
37
+ raise "usage: fablicop init" unless args.empty?
38
+ template_path = File.expand_path("../../templates", __dir__)
39
+ puts "#{File.exist?(CONFIG_FILE_NAME) ? "overwrite" : "create"} #{CONFIG_FILE_NAME}"
40
+ FileUtils.copy_file(File.join(template_path, CONFIG_FILE_NAME), CONFIG_FILE_NAME)
41
+ end
42
+ end
43
+ end
@@ -1,3 +1,3 @@
1
1
  module Fablicop
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -0,0 +1,12 @@
1
+ inherit_gem:
2
+ fablicop:
3
+ - "config/.rubocop.yml"
4
+ # uncomment if use rails cops
5
+ # - "config/rails.yml"
6
+ # uncomment if use rspec cops
7
+ # - "config/rspec.yml"
8
+
9
+ AllCops:
10
+ TargetRubyVersion: 2.4
11
+ # uncomment if use rails cops
12
+ # TargetRailsVersion: 5.1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fablicop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Tomy
7
+ - tommy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-29 00:00:00.000000000 Z
11
+ date: 2017-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -69,7 +69,8 @@ dependencies:
69
69
  description: fablicop is a RuboCop configration gem.
70
70
  email:
71
71
  - kazushige_tominaga@fablic.co.jp
72
- executables: []
72
+ executables:
73
+ - fablicop
73
74
  extensions: []
74
75
  extra_rdoc_files: []
75
76
  files:
@@ -81,10 +82,13 @@ files:
81
82
  - Rakefile
82
83
  - bin/console
83
84
  - bin/setup
84
- - config/rubocop.yml
85
+ - config/.rubocop.yml
86
+ - exe/fablicop
85
87
  - fablicop.gemspec
86
88
  - lib/fablicop.rb
89
+ - lib/fablicop/cli.rb
87
90
  - lib/fablicop/version.rb
91
+ - templates/.rubocop.yml
88
92
  homepage: https://github.com/Fablic/fablicop
89
93
  licenses:
90
94
  - MIT
@@ -105,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
109
  version: '0'
106
110
  requirements: []
107
111
  rubyforge_project:
108
- rubygems_version: 2.5.1
112
+ rubygems_version: 2.6.11
109
113
  signing_key:
110
114
  specification_version: 4
111
115
  summary: fablicop is a RuboCop configration gem.
@@ -1,2 +0,0 @@
1
- inherit_gem:
2
- fablicop: "config/rubocop.yml"