mry 0.52.0.0 → 0.53.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +9 -2
- data/bin/check_rubocop_update +94 -0
- data/lib/mry/added_cops.rb +16 -1
- data/lib/mry/rewriters.rb +11 -1
- data/lib/mry/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2eaf029a8c3e25b5f2735db4b479a3938238c37ea11268ef6455fb246c490a4c
|
4
|
+
data.tar.gz: 06b2dc193c00736aa14a8ef7be5d97447e61ccfe43345bd602ea034873521cd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c206cf61303233db93407ab7f75fbdb87acde94dc5388628dad70d61ae4b940cef28968659e18e615912b1b481d7cc356b01d3d0c1744c1bc92f6f5ad50c0cc
|
7
|
+
data.tar.gz: f53feb055daffede768686d88b918ecf71207634c0e1c428ff0897339de67b94ca370cbcb18c9734f2460517230114bfa75ad9dc0b454e5d8d7dcf7472c5719f
|
data/.travis.yml
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- 2.3.
|
5
|
-
- 2.4.
|
4
|
+
- 2.3.6
|
5
|
+
- 2.4.3
|
6
|
+
- 2.5.0
|
6
7
|
- ruby-head
|
7
8
|
|
8
9
|
cache: bundler
|
@@ -10,6 +11,12 @@ bundler_args: --jobs=4 --retry=3
|
|
10
11
|
sudo: false
|
11
12
|
|
12
13
|
|
14
|
+
before_install: 'gem update --system'
|
13
15
|
|
14
16
|
script:
|
15
17
|
- bundle exec rake test
|
18
|
+
|
19
|
+
matrix:
|
20
|
+
allow_failures:
|
21
|
+
- rvm: ruby-head
|
22
|
+
fast_finish: true
|
@@ -0,0 +1,94 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Usage: bin/check_rubocop_update v0.52.1 v0.53.0
|
4
|
+
|
5
|
+
require 'open3'
|
6
|
+
require 'yaml'
|
7
|
+
require 'tmpdir'
|
8
|
+
|
9
|
+
def debug_print(mes)
|
10
|
+
$stdout.puts mes
|
11
|
+
end
|
12
|
+
|
13
|
+
def sh!(*cmd)
|
14
|
+
debug_print 'sh!: ' + cmd.join(' ')
|
15
|
+
system(*cmd, exception: true)
|
16
|
+
end
|
17
|
+
|
18
|
+
def capture3!(*cmd)
|
19
|
+
debug_print 'capture3!: ' + cmd.join(' ')
|
20
|
+
Open3.capture3(*cmd).tap do |out, err, status|
|
21
|
+
raise "#{out} #{err}" unless status.success?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def each_commit(before, after, &block)
|
26
|
+
return enum_for(__method__, before, after) unless block_given?
|
27
|
+
|
28
|
+
commits = capture3!('git', 'log', "#{before}..#{after}", '--format=tformat:%H').yield_self do |stdout, _stderr, _status|
|
29
|
+
stdout.each_line.map(&:chomp)
|
30
|
+
end
|
31
|
+
commits.each do |commit|
|
32
|
+
sh! 'rm', '-f', 'Gemfile.lock' if File.exist?('Gemfile.lock')
|
33
|
+
sh! 'bundle', 'install' if has_gemfile_change?(commit)
|
34
|
+
sh! 'git', 'checkout', commit
|
35
|
+
block.call
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def has_gemfile_change?(commit)
|
40
|
+
capture3!('git', 'show', '--name-only', '--format=tformat:', commit).yield_self do |stdout, _stderr, _status|
|
41
|
+
stdout.each_line.any? do |fname|
|
42
|
+
fname.chomp!
|
43
|
+
fname == 'Gemfile' || fname == 'rubocop.gemspec'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def chtmpdir(&block)
|
49
|
+
Dir.mktmpdir do |dir|
|
50
|
+
Dir.chdir(dir) do
|
51
|
+
block.call
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def main(before, after)
|
57
|
+
{}.tap do |result|
|
58
|
+
result[:added] = []
|
59
|
+
result[:renamed] = []
|
60
|
+
result[:deleted] = []
|
61
|
+
|
62
|
+
chtmpdir do
|
63
|
+
sh! 'git', 'clone', 'git@github.com:bbatsov/rubocop.git'
|
64
|
+
Dir.chdir('./rubocop') do
|
65
|
+
cops = each_commit(before + '~', after).map do
|
66
|
+
capture3!('bin/rubocop', '--show-cops').yield_self do |stdout, _, _|
|
67
|
+
YAML.load(stdout)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
cops.each_cons(2) do |new, old|
|
71
|
+
added = new.keys - old.keys
|
72
|
+
removed = old.keys - new.keys
|
73
|
+
if added.size > removed.size && removed.size == 0
|
74
|
+
result[:added].concat added
|
75
|
+
elsif added.size < removed.size && added.size == 0
|
76
|
+
result[:deleted].concat removed
|
77
|
+
elsif added.size != 0 && removed.size != 0
|
78
|
+
result[:renamed] << {before: removed, after: added}
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
before = ARGV[0]
|
87
|
+
after = ARGV[1]
|
88
|
+
|
89
|
+
out = main(before, after)
|
90
|
+
res = YAML.dump(out)
|
91
|
+
puts res
|
92
|
+
fname = '/tmp/mry_check_rubocop_update_log.yaml'
|
93
|
+
File.write(fname, res)
|
94
|
+
puts "Wrote: #{fname}"
|
data/lib/mry/added_cops.rb
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
module Mry
|
2
2
|
module AddedCops
|
3
3
|
Cops = {
|
4
|
+
Gem::Version.new('0.53.0') => %w[
|
5
|
+
Rails/ActiveRecordAliases
|
6
|
+
Style/EmptyLineAfterGuardClause
|
7
|
+
Naming/MemoizedInstanceVariableName
|
8
|
+
Style/ExpandPathArguments
|
9
|
+
Lint/OrderedMagicComments
|
10
|
+
Layout/EmptyComment
|
11
|
+
Style/TrailingBodyOnModule
|
12
|
+
Style/TrailingBodyOnClass
|
13
|
+
Lint/NumberConversion
|
14
|
+
Lint/UnneededCopEnableDirective
|
15
|
+
Naming/UncommunicativeBlockParamName
|
16
|
+
Naming/UncommunicativeMethodArgName
|
17
|
+
Security/Open
|
18
|
+
Lint/BigDecimalNew
|
19
|
+
],
|
4
20
|
Gem::Version.new('0.52.0') => %w[
|
5
21
|
Style/StringHashKeys
|
6
22
|
Style/RandomWithOffset
|
@@ -18,7 +34,6 @@ module Mry
|
|
18
34
|
Style/ColonMethodDefinition
|
19
35
|
Layout/ClassStructure
|
20
36
|
Rails/CreateTableWithTimestamps
|
21
|
-
Style/ExtendSelf
|
22
37
|
Rails/RedundantReceiverInWithOptions
|
23
38
|
Style/EvalWithLocation
|
24
39
|
Layout/EmptyLinesAroundArguments
|
data/lib/mry/rewriters.rb
CHANGED
@@ -3,6 +3,15 @@ module Mry
|
|
3
3
|
class Rewriter_Master < YAMLRewriter::Rewriter
|
4
4
|
end
|
5
5
|
|
6
|
+
class Rewriter_0_53_0 < YAMLRewriter::Rewriter
|
7
|
+
define_rule ['Naming/UncommunicativeMethodArgName' => 'Naming/UncommunicativeMethodParamName']
|
8
|
+
define_rule ['Lint/ConditionPosition' => 'Layout/ConditionPosition']
|
9
|
+
define_rule ['Lint/BlockAlignment' => 'Layout/BlockAlignment']
|
10
|
+
define_rule ['Lint/DefEndAlignment' => 'Layout/DefEndAlignment']
|
11
|
+
define_rule ['Lint/EndAlignment' => 'Layout/EndAlignment']
|
12
|
+
define_rule ['Lint/UnneededDisable' => 'Lint/UnneededCopDisableDirective']
|
13
|
+
end
|
14
|
+
|
6
15
|
class Rewriter_0_52_0 < YAMLRewriter::Rewriter
|
7
16
|
define_rule ['Lint/RescueWithoutErrorClass' => 'Style/RescueStandardError']
|
8
17
|
end
|
@@ -150,7 +159,8 @@ module Mry
|
|
150
159
|
end
|
151
160
|
|
152
161
|
Rewriters = {
|
153
|
-
Gem::Version.new('0.
|
162
|
+
Gem::Version.new('0.53.0') => Rewriter_0_53_0,
|
163
|
+
Gem::Version.new('0.52.0') => Rewriter_0_52_0,
|
154
164
|
Gem::Version.new('0.51.0') => Rewriter_0_51_0,
|
155
165
|
Gem::Version.new('0.50.0') => Rewriter_0_50_0,
|
156
166
|
Gem::Version.new('0.49.0') => Rewriter_0_49_0,
|
data/lib/mry/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.53.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masataka Kuwabara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- LICENSE
|
139
139
|
- README.md
|
140
140
|
- Rakefile
|
141
|
+
- bin/check_rubocop_update
|
141
142
|
- bin/console
|
142
143
|
- bin/setup
|
143
144
|
- exe/mry
|
@@ -174,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
175
|
version: '0'
|
175
176
|
requirements: []
|
176
177
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.6
|
178
|
+
rubygems_version: 2.7.6
|
178
179
|
signing_key:
|
179
180
|
specification_version: 4
|
180
181
|
summary: Mry Migrates .Rubocop.Yml
|