rfix 1.0.7.pre.66 → 1.0.8.pre.109
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +20 -0
- data/.rubocop.yml +4 -0
- data/.travis.yml +6 -10
- data/Gemfile +2 -16
- data/Gemfile.base +7 -0
- data/Gemfile.lock +14 -44
- data/Makefile +13 -0
- data/README.md +66 -13
- data/Rakefile +56 -46
- data/bin/bundle +114 -0
- data/bin/console +23 -9
- data/bin/guard +29 -0
- data/bin/rake +29 -0
- data/bin/rfix +29 -0
- data/bin/rspec +29 -0
- data/bin/setup +27 -6
- data/ci/Gemfile.rubocop-0.80 +1 -1
- data/ci/Gemfile.rubocop-0.80.lock +15 -46
- data/ci/Gemfile.rubocop-0.81 +1 -1
- data/ci/Gemfile.rubocop-0.81.lock +15 -46
- data/ci/Gemfile.rubocop-0.82 +2 -2
- data/ci/Gemfile.rubocop-0.82.lock +16 -47
- data/ci/Gemfile.rubocop-0.83 +1 -1
- data/ci/Gemfile.rubocop-0.83.lock +15 -46
- data/ci/Gemfile.rubocop-0.84 +1 -1
- data/ci/Gemfile.rubocop-0.84.lock +15 -46
- data/ci/Gemfile.rubocop-0.85 +1 -1
- data/ci/Gemfile.rubocop-0.85.1 +1 -1
- data/ci/Gemfile.rubocop-0.85.1.lock +15 -46
- data/ci/Gemfile.rubocop-0.85.lock +15 -46
- data/exe/rfix +35 -41
- data/file.rb +1 -0
- data/lib/rfix.rb +1 -1
- data/lib/rfix/cmd.rb +8 -2
- data/lib/rfix/gem_helper.rb +12 -0
- data/lib/rfix/git_helper.rb +19 -2
- data/lib/rfix/log.rb +4 -2
- data/lib/rfix/rake_helper.rb +56 -0
- data/lib/rfix/rfix.rb +104 -4
- data/lib/rfix/version.rb +1 -1
- data/resources/ps.png +0 -0
- data/rfix.gemspec +17 -12
- metadata +90 -38
data/ci/Gemfile.rubocop-0.85
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
eval_gemfile("../Gemfile")
|
1
|
+
eval_gemfile(File.join(__dir__, "../Gemfile.base"))
|
2
2
|
gem "rubocop", "0.85.0"
|
data/ci/Gemfile.rubocop-0.85.1
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
eval_gemfile("../Gemfile")
|
1
|
+
eval_gemfile(File.join(__dir__, "../Gemfile.base"))
|
2
2
|
gem "rubocop", "0.85.1"
|
@@ -1,42 +1,22 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/Shopify/cli-ui.git
|
3
|
-
revision: ef976df676f43a80b47249ac2390d5f12b2293d1
|
4
|
-
ref: ef976df676f4
|
5
|
-
specs:
|
6
|
-
cli-ui (1.3.0)
|
7
|
-
|
8
|
-
GIT
|
9
|
-
remote: https://github.com/oleander/git-fame-rb.git
|
10
|
-
revision: a9b9c25bbab197feaee00f9a5c970998e76f636c
|
11
|
-
ref: a9b9c25bbab1
|
12
|
-
specs:
|
13
|
-
git_fame (2.5.3)
|
14
|
-
hirb (~> 0.7.3)
|
15
|
-
memoist (~> 0.14.0)
|
16
|
-
method_profiler (~> 2.0.1)
|
17
|
-
progressbar (~> 0.21.0)
|
18
|
-
scrub_rb (~> 1.0.1)
|
19
|
-
trollop (~> 2.1.2)
|
20
|
-
|
21
1
|
PATH
|
22
|
-
remote:
|
2
|
+
remote: .
|
23
3
|
specs:
|
24
|
-
rfix (0.
|
4
|
+
rfix (1.0.8)
|
25
5
|
rainbow (~> 3.0)
|
26
6
|
rouge (~> 3.20)
|
27
|
-
rubocop (
|
7
|
+
rubocop (>= 0.80)
|
28
8
|
|
29
9
|
GEM
|
30
10
|
remote: https://rubygems.org/
|
31
11
|
specs:
|
32
|
-
activesupport (6.0.3.
|
12
|
+
activesupport (6.0.3.2)
|
33
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
14
|
i18n (>= 0.7, < 2)
|
35
15
|
minitest (~> 5.1)
|
36
16
|
tzinfo (~> 1.1)
|
37
17
|
zeitwerk (~> 2.2, >= 2.2.2)
|
38
|
-
aruba (1.0.
|
39
|
-
childprocess (
|
18
|
+
aruba (1.0.2)
|
19
|
+
childprocess (>= 2.0, < 5.0)
|
40
20
|
contracts (~> 0.16.0)
|
41
21
|
cucumber (>= 2.4, < 5.0)
|
42
22
|
ffi (~> 1.9)
|
@@ -44,7 +24,7 @@ GEM
|
|
44
24
|
thor (~> 1.0)
|
45
25
|
ast (2.4.1)
|
46
26
|
builder (3.2.4)
|
47
|
-
childprocess (
|
27
|
+
childprocess (4.0.0)
|
48
28
|
coderay (1.1.3)
|
49
29
|
concurrent-ruby (1.1.6)
|
50
30
|
contracts (0.16.0)
|
@@ -78,6 +58,7 @@ GEM
|
|
78
58
|
diff-lcs (1.3)
|
79
59
|
ffi (1.13.1)
|
80
60
|
formatador (0.2.5)
|
61
|
+
gem-release (2.1.1)
|
81
62
|
guard (2.16.2)
|
82
63
|
formatador (>= 0.2.4)
|
83
64
|
listen (>= 2.7, < 4.0)
|
@@ -92,16 +73,12 @@ GEM
|
|
92
73
|
guard (~> 2.1)
|
93
74
|
guard-compat (~> 1.1)
|
94
75
|
rspec (>= 2.99.0, < 4.0)
|
95
|
-
hirb (0.7.3)
|
96
76
|
i18n (1.8.3)
|
97
77
|
concurrent-ruby (~> 1.0)
|
98
78
|
listen (3.2.1)
|
99
79
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
100
80
|
rb-inotify (~> 0.9, >= 0.9.10)
|
101
|
-
lumberjack (1.2.
|
102
|
-
memoist (0.14.0)
|
103
|
-
method_profiler (2.0.1)
|
104
|
-
hirb (>= 0.6.0)
|
81
|
+
lumberjack (1.2.6)
|
105
82
|
method_source (1.0.0)
|
106
83
|
middleware (0.1.0)
|
107
84
|
minitest (5.14.1)
|
@@ -110,10 +87,9 @@ GEM
|
|
110
87
|
notiffany (0.1.3)
|
111
88
|
nenv (~> 0.1)
|
112
89
|
shellany (~> 0.0)
|
113
|
-
parallel (1.19.
|
114
|
-
parser (2.7.1.
|
115
|
-
ast (~> 2.4.
|
116
|
-
progressbar (0.21.0)
|
90
|
+
parallel (1.19.2)
|
91
|
+
parser (2.7.1.4)
|
92
|
+
ast (~> 2.4.1)
|
117
93
|
protobuf-cucumber (3.10.8)
|
118
94
|
activesupport (>= 3.2)
|
119
95
|
middleware
|
@@ -155,13 +131,11 @@ GEM
|
|
155
131
|
rubocop-ast (0.0.3)
|
156
132
|
parser (>= 2.7.0.1)
|
157
133
|
ruby-progressbar (1.10.1)
|
158
|
-
scrub_rb (1.0.1)
|
159
134
|
shellany (0.0.1)
|
160
135
|
sys-uname (1.2.1)
|
161
136
|
ffi (>= 1.0.0)
|
162
137
|
thor (1.0.1)
|
163
138
|
thread_safe (0.3.6)
|
164
|
-
trollop (2.1.3)
|
165
139
|
tzinfo (1.2.7)
|
166
140
|
thread_safe (~> 0.1)
|
167
141
|
unicode-display_width (1.7.0)
|
@@ -171,19 +145,14 @@ PLATFORMS
|
|
171
145
|
ruby
|
172
146
|
|
173
147
|
DEPENDENCIES
|
174
|
-
aruba
|
175
|
-
|
176
|
-
git_fame!
|
148
|
+
aruba (~> 1.0)
|
149
|
+
gem-release
|
177
150
|
guard
|
178
151
|
guard-rspec
|
179
|
-
|
180
|
-
rake (~> 12.0)
|
152
|
+
rake (~> 12.3)
|
181
153
|
rfix!
|
182
154
|
rspec (~> 3.0)
|
183
155
|
rubocop (= 0.85.1)
|
184
156
|
|
185
|
-
RUBY VERSION
|
186
|
-
ruby 2.5.0p0
|
187
|
-
|
188
157
|
BUNDLED WITH
|
189
158
|
2.1.4
|
@@ -1,42 +1,22 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/Shopify/cli-ui.git
|
3
|
-
revision: ef976df676f43a80b47249ac2390d5f12b2293d1
|
4
|
-
ref: ef976df676f4
|
5
|
-
specs:
|
6
|
-
cli-ui (1.3.0)
|
7
|
-
|
8
|
-
GIT
|
9
|
-
remote: https://github.com/oleander/git-fame-rb.git
|
10
|
-
revision: a9b9c25bbab197feaee00f9a5c970998e76f636c
|
11
|
-
ref: a9b9c25bbab1
|
12
|
-
specs:
|
13
|
-
git_fame (2.5.3)
|
14
|
-
hirb (~> 0.7.3)
|
15
|
-
memoist (~> 0.14.0)
|
16
|
-
method_profiler (~> 2.0.1)
|
17
|
-
progressbar (~> 0.21.0)
|
18
|
-
scrub_rb (~> 1.0.1)
|
19
|
-
trollop (~> 2.1.2)
|
20
|
-
|
21
1
|
PATH
|
22
|
-
remote:
|
2
|
+
remote: .
|
23
3
|
specs:
|
24
|
-
rfix (0.
|
4
|
+
rfix (1.0.8)
|
25
5
|
rainbow (~> 3.0)
|
26
6
|
rouge (~> 3.20)
|
27
|
-
rubocop (
|
7
|
+
rubocop (>= 0.80)
|
28
8
|
|
29
9
|
GEM
|
30
10
|
remote: https://rubygems.org/
|
31
11
|
specs:
|
32
|
-
activesupport (6.0.3.
|
12
|
+
activesupport (6.0.3.2)
|
33
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
14
|
i18n (>= 0.7, < 2)
|
35
15
|
minitest (~> 5.1)
|
36
16
|
tzinfo (~> 1.1)
|
37
17
|
zeitwerk (~> 2.2, >= 2.2.2)
|
38
|
-
aruba (1.0.
|
39
|
-
childprocess (
|
18
|
+
aruba (1.0.2)
|
19
|
+
childprocess (>= 2.0, < 5.0)
|
40
20
|
contracts (~> 0.16.0)
|
41
21
|
cucumber (>= 2.4, < 5.0)
|
42
22
|
ffi (~> 1.9)
|
@@ -44,7 +24,7 @@ GEM
|
|
44
24
|
thor (~> 1.0)
|
45
25
|
ast (2.4.1)
|
46
26
|
builder (3.2.4)
|
47
|
-
childprocess (
|
27
|
+
childprocess (4.0.0)
|
48
28
|
coderay (1.1.3)
|
49
29
|
concurrent-ruby (1.1.6)
|
50
30
|
contracts (0.16.0)
|
@@ -78,6 +58,7 @@ GEM
|
|
78
58
|
diff-lcs (1.3)
|
79
59
|
ffi (1.13.1)
|
80
60
|
formatador (0.2.5)
|
61
|
+
gem-release (2.1.1)
|
81
62
|
guard (2.16.2)
|
82
63
|
formatador (>= 0.2.4)
|
83
64
|
listen (>= 2.7, < 4.0)
|
@@ -92,16 +73,12 @@ GEM
|
|
92
73
|
guard (~> 2.1)
|
93
74
|
guard-compat (~> 1.1)
|
94
75
|
rspec (>= 2.99.0, < 4.0)
|
95
|
-
hirb (0.7.3)
|
96
76
|
i18n (1.8.3)
|
97
77
|
concurrent-ruby (~> 1.0)
|
98
78
|
listen (3.2.1)
|
99
79
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
100
80
|
rb-inotify (~> 0.9, >= 0.9.10)
|
101
|
-
lumberjack (1.2.
|
102
|
-
memoist (0.14.0)
|
103
|
-
method_profiler (2.0.1)
|
104
|
-
hirb (>= 0.6.0)
|
81
|
+
lumberjack (1.2.6)
|
105
82
|
method_source (1.0.0)
|
106
83
|
middleware (0.1.0)
|
107
84
|
minitest (5.14.1)
|
@@ -110,10 +87,9 @@ GEM
|
|
110
87
|
notiffany (0.1.3)
|
111
88
|
nenv (~> 0.1)
|
112
89
|
shellany (~> 0.0)
|
113
|
-
parallel (1.19.
|
114
|
-
parser (2.7.1.
|
115
|
-
ast (~> 2.4.
|
116
|
-
progressbar (0.21.0)
|
90
|
+
parallel (1.19.2)
|
91
|
+
parser (2.7.1.4)
|
92
|
+
ast (~> 2.4.1)
|
117
93
|
protobuf-cucumber (3.10.8)
|
118
94
|
activesupport (>= 3.2)
|
119
95
|
middleware
|
@@ -155,13 +131,11 @@ GEM
|
|
155
131
|
rubocop-ast (0.0.3)
|
156
132
|
parser (>= 2.7.0.1)
|
157
133
|
ruby-progressbar (1.10.1)
|
158
|
-
scrub_rb (1.0.1)
|
159
134
|
shellany (0.0.1)
|
160
135
|
sys-uname (1.2.1)
|
161
136
|
ffi (>= 1.0.0)
|
162
137
|
thor (1.0.1)
|
163
138
|
thread_safe (0.3.6)
|
164
|
-
trollop (2.1.3)
|
165
139
|
tzinfo (1.2.7)
|
166
140
|
thread_safe (~> 0.1)
|
167
141
|
unicode-display_width (1.7.0)
|
@@ -171,19 +145,14 @@ PLATFORMS
|
|
171
145
|
ruby
|
172
146
|
|
173
147
|
DEPENDENCIES
|
174
|
-
aruba
|
175
|
-
|
176
|
-
git_fame!
|
148
|
+
aruba (~> 1.0)
|
149
|
+
gem-release
|
177
150
|
guard
|
178
151
|
guard-rspec
|
179
|
-
|
180
|
-
rake (~> 12.0)
|
152
|
+
rake (~> 12.3)
|
181
153
|
rfix!
|
182
154
|
rspec (~> 3.0)
|
183
155
|
rubocop (= 0.85.0)
|
184
156
|
|
185
|
-
RUBY VERSION
|
186
|
-
ruby 2.5.0p0
|
187
|
-
|
188
157
|
BUNDLED WITH
|
189
158
|
2.1.4
|
data/exe/rfix
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
|
2
3
|
# frozen_string_literal: true
|
3
4
|
|
4
5
|
require "rfix"
|
@@ -9,55 +10,41 @@ require "cli/ui"
|
|
9
10
|
should_list_files = false
|
10
11
|
limit_files = false
|
11
12
|
options = RuboCop::Options.new
|
12
|
-
|
13
|
+
|
13
14
|
display_help = ARGV.include?("--help")
|
14
15
|
is_dry = ARGV.include?("--dry")
|
15
16
|
config_path = false
|
17
|
+
clear_cache = false
|
16
18
|
|
17
19
|
extend Rfix::Log
|
18
20
|
Rfix.init!
|
19
21
|
CLI::UI::StdoutRouter.enable
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
base_config = {
|
24
|
-
color: true,
|
25
|
-
force_exclusion: true,
|
26
|
-
auto_correct: true,
|
27
|
-
formatters: ["Rfix::Formatter"]
|
28
|
-
}
|
29
|
-
|
30
|
-
# For version 0.80.x .. 0.83.x:
|
31
|
-
# Otherwise it will exit with status code = 1
|
32
|
-
if (0.80..0.83).include?(RuboCop::Version::STRING.to_f)
|
33
|
-
if is_dry
|
34
|
-
base_config[:fail_level] = :autocorrect
|
35
|
-
else
|
36
|
-
base_config[:fail_level] = :warning
|
37
|
-
end
|
23
|
+
if ARGV.include?("--debug")
|
24
|
+
Rfix.debug!
|
38
25
|
end
|
39
26
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
27
|
+
say "Using RuboCop {{yellow:#{RuboCop::Version.version}}}"
|
28
|
+
say_debug "Current directory {{italic:#{Dir.pwd}}}"
|
29
|
+
say_debug "[Ruby] {{italic:#{RbConfig.ruby}}}"
|
30
|
+
|
31
|
+
options.on("--untracked", "Include untracked files") do
|
32
|
+
Rfix.load_untracked!
|
46
33
|
end
|
47
34
|
|
48
35
|
options.on("--dry", "No auto correct") do
|
49
36
|
say "Will run rfix in {{red:read-only}} mode"
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
options.on("--untracked", "Include untracked files") do
|
54
|
-
Rfix.load_untracked!
|
37
|
+
Rfix.no_auto_correct!
|
55
38
|
end
|
56
39
|
|
57
40
|
options.on("--list-files", "List files found by git") do
|
58
41
|
should_list_files = true
|
59
42
|
end
|
60
43
|
|
44
|
+
options.on("--clear-cache", "Clear RuboCop cache") do
|
45
|
+
clear_cache = true
|
46
|
+
end
|
47
|
+
|
61
48
|
options.on("--limit-files NUM", Integer, "Limit number of files") do |limit|
|
62
49
|
limit_files = limit
|
63
50
|
end
|
@@ -72,7 +59,12 @@ when "info"
|
|
72
59
|
say "Using OS {{yellow:#{Rfix.current_os}}}"
|
73
60
|
say "Using Git {{yellow:#{Rfix.git_version}}}"
|
74
61
|
say "Using Ruby {{yellow:#{Rfix.ruby_version}}}"
|
62
|
+
say "Current Git branch {{yellow:#{Rfix.current_branch}}}"
|
63
|
+
say "Number of commits {{yellow:#{Rfix.number_of_commits_since}}}"
|
75
64
|
exit 0
|
65
|
+
when "lint"
|
66
|
+
Rfix.lint_mode!
|
67
|
+
reference = Rfix.ref_since_push
|
76
68
|
when "local"
|
77
69
|
reference = Rfix.ref_since_push
|
78
70
|
when "origin"
|
@@ -96,14 +88,7 @@ when "branch"
|
|
96
88
|
else
|
97
89
|
unless display_help
|
98
90
|
say_error "Valid rfix commands are:"
|
99
|
-
|
100
|
-
say_error_sub "\t{{bold:rfix branch <branch>}} -- {{italic:Fix changes made between HEAD and <branch>}}"
|
101
|
-
say_error_sub "\t{{bold:rfix origin}} -- {{italic:Fix changes made between HEAD and origin branch}}"
|
102
|
-
say_error_sub "\t{{bold:rfix local}} -- {{italic:Fix changes not yet pushed to upstream branch}}"
|
103
|
-
say_error_sub "\t{{bold:rfix info}} -- {{italic:Display runtime dependencies and their versions}}"
|
104
|
-
say_error_sub "\t{{bold:rfix all}} -- {{italic:Fix all files in this repository}} {{warning:(not recommended)}}"
|
105
|
-
say_error_sub "\n"
|
106
|
-
say_error_sub "\t{{italic:Optional args: --dry --help --list-files --limit-files --config --untracked}}"
|
91
|
+
say_error Rfix.help
|
107
92
|
exit 1
|
108
93
|
end
|
109
94
|
|
@@ -117,15 +102,22 @@ rescue OptionParser::MissingArgument => e
|
|
117
102
|
end
|
118
103
|
|
119
104
|
if path = config_path
|
120
|
-
load_config do
|
105
|
+
Rfix.load_config do |config|
|
106
|
+
say_debug "[Config:Option] Load from #{path}"
|
121
107
|
config.options_config = path
|
122
108
|
end
|
123
109
|
else
|
124
|
-
load_config do
|
110
|
+
Rfix.load_config do |config|
|
111
|
+
say_debug "[Config:PWD] Load from #{Dir.pwd}"
|
125
112
|
config.for(Dir.pwd)
|
126
113
|
end
|
127
114
|
end
|
128
115
|
|
116
|
+
if clear_cache
|
117
|
+
say "Clearing cache"
|
118
|
+
Rfix.clear_cache!
|
119
|
+
end
|
120
|
+
|
129
121
|
if ref = reference
|
130
122
|
say "Compare against {{yellow:#{ref}}}"
|
131
123
|
|
@@ -148,9 +140,11 @@ if should_list_files
|
|
148
140
|
end
|
149
141
|
end
|
150
142
|
|
143
|
+
say_debug "[Config:Dump] #{Rfix.store}"
|
144
|
+
|
151
145
|
env = RuboCop::CLI::Environment.new(
|
152
|
-
|
153
|
-
|
146
|
+
Rfix.config.merge(options),
|
147
|
+
Rfix.store,
|
154
148
|
paths
|
155
149
|
)
|
156
150
|
|
data/file.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"hello"
|
data/lib/rfix.rb
CHANGED
data/lib/rfix/cmd.rb
CHANGED
@@ -7,13 +7,15 @@ require "rfix/log"
|
|
7
7
|
module Rfix::Cmd
|
8
8
|
include Rfix::Log
|
9
9
|
|
10
|
-
def cmd(*args)
|
10
|
+
def cmd(*args, quiet: false)
|
11
11
|
out, err, status = Open3.capture3(*args)
|
12
12
|
|
13
|
+
# say "[Cmd] {{italic:#{args.join(' ')}}}"
|
13
14
|
unless status.success?
|
14
15
|
return yield if block_given?
|
16
|
+
return if quiet
|
15
17
|
|
16
|
-
say_error "[Cmd] {{italic:#{args.join(
|
18
|
+
say_error "[Cmd] {{italic:#{args.join(' ')}}}"
|
17
19
|
say_error "[Pwd] {{italic:#{Dir.pwd}}}"
|
18
20
|
say_error "[Err] {{error:#{err.strip}}}"
|
19
21
|
|
@@ -23,6 +25,10 @@ module Rfix::Cmd
|
|
23
25
|
out.lines.map(&:chomp)
|
24
26
|
end
|
25
27
|
|
28
|
+
def cmd_succeeded?(*cmd)
|
29
|
+
Open3.capture2e(*cmd).last.success?
|
30
|
+
end
|
31
|
+
|
26
32
|
def params
|
27
33
|
[
|
28
34
|
"--word-diff-regex=[^[:space:]]",
|