rfix 1.0.6.pre.60 → 1.0.7.pre.67
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -2
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/exe/rfix +10 -31
- data/lib/rfix.rb +14 -1
- data/lib/rfix/extensions/extensions.rb +40 -0
- data/lib/rfix/extensions/offense.rb +77 -0
- data/lib/rfix/formatter.rb +1 -24
- data/lib/rfix/git_helper.rb +3 -1
- data/lib/rfix/rfix.rb +49 -0
- data/lib/rfix/version.rb +1 -1
- data/rfix.gemspec +14 -1
- metadata +14 -5
- data/lib/rfix/extensions.rb +0 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18adac7bf6bfb125c3cac54933353fb5c52a6a60854f0001afa0c5bdc69ece87
|
4
|
+
data.tar.gz: 1f1656bec3253bb8d609fa35fd157d60c45510e2fc787cf44139ae39dda756f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dac6c467ca60c677bceb2926e3f78ee86164ecda79b50a010595d40a8a5e924fa2182fbe7d90f64b5158abd36aa5b7860b107b2c2495748abfed15154da50d6
|
7
|
+
data.tar.gz: 29c0aca1abaa4ba8b3d13169128f052324061709ca7c03b01296b395d6f00b8dae8e76f231bd59942a350811ed6cb9d5b8a425b37bfd32a8bd01e7b368ed16a1
|
data/.travis.yml
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
language: ruby
|
2
|
+
cache:
|
3
|
+
bundler: true
|
4
|
+
directories:
|
5
|
+
- $HOME/.rvm
|
6
|
+
- $HOME/Library/Caches/Homebrew
|
7
|
+
before_cache:
|
8
|
+
- brew cleanup
|
2
9
|
rvm:
|
3
10
|
- 2.5.0
|
4
11
|
- 2.6.2
|
@@ -17,8 +24,7 @@ gemfile:
|
|
17
24
|
- ci/Gemfile.rubocop-0.85.1
|
18
25
|
before_install:
|
19
26
|
- yes | gem update --system --force
|
20
|
-
- gem
|
21
|
-
- gem install bundler -v 2.1.4
|
27
|
+
- gem install bundler
|
22
28
|
- bundle config git.allow_insecure true
|
23
29
|
install:
|
24
30
|
- bundle install
|
@@ -37,4 +43,5 @@ jobs:
|
|
37
43
|
gem: rfix
|
38
44
|
on:
|
39
45
|
repo: oleander/rfix-rb
|
46
|
+
tags: false
|
40
47
|
cleanup: 'false'
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Rfix [](https://travis-ci.org/oleander/rfix-rb)
|
1
|
+
# Rfix [](https://travis-ci.org/oleander/rfix-rb) [](https://rubygems.org/gems/rfix)
|
2
2
|
|
3
3
|
RuboCop CLI that only complains about your latest changes
|
4
4
|
|
data/exe/rfix
CHANGED
@@ -20,38 +20,13 @@ CLI::UI::StdoutRouter.enable
|
|
20
20
|
|
21
21
|
say "Using RuboCop {{yellow:#{RuboCop::Version.version}}}"
|
22
22
|
|
23
|
-
|
24
|
-
|
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
|
38
|
-
end
|
39
|
-
|
40
|
-
def load_config
|
41
|
-
yield
|
42
|
-
rescue RuboCop::Error => e
|
43
|
-
say_abort "[Config] #{e}"
|
44
|
-
rescue TypeError => e
|
45
|
-
say_abort "[Config] #{e}"
|
23
|
+
options.on("--untracked", "Include untracked files") do
|
24
|
+
Rfix.load_untracked!
|
46
25
|
end
|
47
26
|
|
48
27
|
options.on("--dry", "No auto correct") do
|
49
28
|
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!
|
29
|
+
Rfix.no_auto_correct!
|
55
30
|
end
|
56
31
|
|
57
32
|
options.on("--list-files", "List files found by git") do
|
@@ -73,6 +48,9 @@ when "info"
|
|
73
48
|
say "Using Git {{yellow:#{Rfix.git_version}}}"
|
74
49
|
say "Using Ruby {{yellow:#{Rfix.ruby_version}}}"
|
75
50
|
exit 0
|
51
|
+
when "lint"
|
52
|
+
Rfix.lint_mode!
|
53
|
+
reference = Rfix.ref_since_push
|
76
54
|
when "local"
|
77
55
|
reference = Rfix.ref_since_push
|
78
56
|
when "origin"
|
@@ -102,6 +80,7 @@ else
|
|
102
80
|
say_error_sub "\t{{bold:rfix local}} -- {{italic:Fix changes not yet pushed to upstream branch}}"
|
103
81
|
say_error_sub "\t{{bold:rfix info}} -- {{italic:Display runtime dependencies and their versions}}"
|
104
82
|
say_error_sub "\t{{bold:rfix all}} -- {{italic:Fix all files in this repository}} {{warning:(not recommended)}}"
|
83
|
+
say_error_sub "\t{{bold:rfix lint}} -- {{italic:Shortcut for 'local --dry --untracked'}}"
|
105
84
|
say_error_sub "\n"
|
106
85
|
say_error_sub "\t{{italic:Optional args: --dry --help --list-files --limit-files --config --untracked}}"
|
107
86
|
exit 1
|
@@ -117,11 +96,11 @@ rescue OptionParser::MissingArgument => e
|
|
117
96
|
end
|
118
97
|
|
119
98
|
if path = config_path
|
120
|
-
load_config do
|
99
|
+
Rfix.load_config do
|
121
100
|
config.options_config = path
|
122
101
|
end
|
123
102
|
else
|
124
|
-
load_config do
|
103
|
+
Rfix.load_config do
|
125
104
|
config.for(Dir.pwd)
|
126
105
|
end
|
127
106
|
end
|
@@ -149,7 +128,7 @@ if should_list_files
|
|
149
128
|
end
|
150
129
|
|
151
130
|
env = RuboCop::CLI::Environment.new(
|
152
|
-
|
131
|
+
Rfix.config.merge(options),
|
153
132
|
config,
|
154
133
|
paths
|
155
134
|
)
|
data/lib/rfix.rb
CHANGED
@@ -5,9 +5,22 @@
|
|
5
5
|
|
6
6
|
require "rfix/version"
|
7
7
|
require "rfix/log"
|
8
|
-
require "rfix/extensions"
|
8
|
+
require "rfix/extensions/extensions"
|
9
|
+
require "rfix/extensions/offense"
|
9
10
|
require "rfix/rfix"
|
10
11
|
|
11
12
|
module Rfix
|
13
|
+
module Ext; end
|
12
14
|
extend self
|
13
15
|
end
|
16
|
+
|
17
|
+
RuboCop::Options.prepend(Rfix::Ext::Options)
|
18
|
+
RuboCop::Runner.prepend(Rfix::Ext::Runner)
|
19
|
+
RuboCop::CommentConfig.prepend(Rfix::Ext::CommentConfig)
|
20
|
+
RuboCop::Cop::Offense.prepend(Rfix::Ext::Offense)
|
21
|
+
|
22
|
+
# TODO: Handle cases where color can't be resolved by CLI::UI
|
23
|
+
RuboCop::Formatter::SimpleTextFormatter::COLOR_FOR_SEVERITY.each do |severity, color|
|
24
|
+
id = RuboCop::Cop::Severity::CODE_TABLE.invert.fetch(severity)
|
25
|
+
CLI::UI::Glyph.new(id.to_s, 0x25cf, CLI::UI.resolve_color(color))
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubocop"
|
4
|
+
require "rainbow"
|
5
|
+
|
6
|
+
module Rfix::Ext
|
7
|
+
module CommentConfig
|
8
|
+
# Called by RuboCop on every line to see
|
9
|
+
# if its suppose to run against it or not
|
10
|
+
def cop_enabled_at_line?(_cop, line)
|
11
|
+
Rfix.enabled?(processed_source.file_path, line) && super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Runner
|
16
|
+
# Called _after_ @source has been 'auto fixed' by Rubocop
|
17
|
+
def check_for_infinite_loop(source, offences)
|
18
|
+
# rubocop:disable Style/Semicolon
|
19
|
+
Rfix.refresh!(source); super
|
20
|
+
# rubocop:enable Style/Semicolon
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module Options
|
25
|
+
# Appends custom --args to RuboCop CLI
|
26
|
+
def define_options
|
27
|
+
super.tap do |options|
|
28
|
+
@ons.each do |args, block|
|
29
|
+
option(options, *args, &block)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Helper method used by rfix to append cli --args to Rubocop
|
35
|
+
def on(*args, &block)
|
36
|
+
@ons ||= []
|
37
|
+
@ons += [[args, block]]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Rfix::Ext
|
2
|
+
module Offense
|
3
|
+
def where
|
4
|
+
line.to_s + ":" + real_column.to_s
|
5
|
+
end
|
6
|
+
|
7
|
+
def info
|
8
|
+
message.split(": ", 2).last.delete("\n")
|
9
|
+
end
|
10
|
+
|
11
|
+
def msg
|
12
|
+
CLI::UI.resolve_text("{{italic:#{info}}}", truncate_to: CLI::UI::Terminal.width - 10)
|
13
|
+
end
|
14
|
+
|
15
|
+
def code
|
16
|
+
message.split(": ", 2).first
|
17
|
+
end
|
18
|
+
|
19
|
+
def star
|
20
|
+
Rainbow("⭑")
|
21
|
+
end
|
22
|
+
|
23
|
+
def cross
|
24
|
+
Rainbow("✗").red
|
25
|
+
end
|
26
|
+
|
27
|
+
def check
|
28
|
+
Rainbow("✓").green
|
29
|
+
end
|
30
|
+
|
31
|
+
def circle
|
32
|
+
Rainbow("⍟")
|
33
|
+
end
|
34
|
+
|
35
|
+
def relative_path
|
36
|
+
Rfix.to_relative(path: location.source_buffer.name)
|
37
|
+
end
|
38
|
+
|
39
|
+
def clickable_path
|
40
|
+
"{{italic:#{relative_path}:#{where}}}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def clickable_plain_severity
|
44
|
+
to_url("https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/#{code}", code)
|
45
|
+
end
|
46
|
+
|
47
|
+
def clickable_severity
|
48
|
+
"{{#{severity.code}}} {{italic:#{clickable_plain_severity}}}"
|
49
|
+
end
|
50
|
+
|
51
|
+
def icon
|
52
|
+
return check.green if corrected?
|
53
|
+
return star.yellow if correctable?
|
54
|
+
|
55
|
+
cross.red
|
56
|
+
end
|
57
|
+
|
58
|
+
def to_clickable(url, title)
|
59
|
+
esc = CLI::UI::ANSI::ESC
|
60
|
+
cmd = esc + "]8;;"
|
61
|
+
slash = "\x07"
|
62
|
+
cmd + "#{escape(url)}#{slash}#{escape(title)}" + cmd + slash
|
63
|
+
end
|
64
|
+
|
65
|
+
def to_path(path, title)
|
66
|
+
to_clickable("file://#{path}", title)
|
67
|
+
end
|
68
|
+
|
69
|
+
def to_url(url, title)
|
70
|
+
to_clickable(url, title)
|
71
|
+
end
|
72
|
+
|
73
|
+
def escape(str)
|
74
|
+
Shellwords.escape(str)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/rfix/formatter.rb
CHANGED
@@ -30,37 +30,14 @@ module Rfix
|
|
30
30
|
report_summary(files.size, offenses.count, corrected.count)
|
31
31
|
end
|
32
32
|
|
33
|
-
def to_clickable(url, title)
|
34
|
-
esc = CLI::UI::ANSI::ESC
|
35
|
-
cmd = esc + "]8;;"
|
36
|
-
slash = "\x07"
|
37
|
-
cmd + "#{escape(url)}#{slash}#{escape(title)}" + cmd + slash
|
38
|
-
end
|
39
|
-
|
40
|
-
def to_path(path, title)
|
41
|
-
to_clickable("file://#{path}", title)
|
42
|
-
end
|
43
|
-
|
44
|
-
def to_url(url, title)
|
45
|
-
to_clickable(url, title)
|
46
|
-
end
|
47
|
-
|
48
|
-
def escape(str)
|
49
|
-
Shellwords.escape(str)
|
50
|
-
end
|
51
|
-
|
52
33
|
def render_file(file, offenses)
|
53
34
|
return if offenses.empty?
|
54
35
|
|
55
|
-
path = Rfix.to_relative(path: file)
|
56
|
-
url = to_url(file, path)
|
57
36
|
offenses.each do |offense|
|
58
37
|
out("\n\n")
|
59
|
-
clickable_path = "{{italic:#{path}:#{offense.where}}}"
|
60
|
-
clickable_code = to_url("https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/#{offense.code}", offense.code)
|
61
38
|
CLI::UI::Frame.open("#{offense.icon} #{offense.msg}", color: :reset)
|
62
39
|
report_line(file, offense, offense.location, offense.highlighted_area)
|
63
|
-
CLI::UI::Frame.close("#{
|
40
|
+
CLI::UI::Frame.close("#{offense.clickable_severity} » #{offense.clickable_path}", color: :reset)
|
64
41
|
end
|
65
42
|
end
|
66
43
|
|
data/lib/rfix/git_helper.rb
CHANGED
data/lib/rfix/rfix.rb
CHANGED
@@ -13,6 +13,39 @@ module Rfix
|
|
13
13
|
include GitHelper
|
14
14
|
include Log
|
15
15
|
|
16
|
+
def config
|
17
|
+
@config
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_fail_level(lint)
|
21
|
+
if
|
22
|
+
if lint
|
23
|
+
else
|
24
|
+
@config[:fail_level] = :warning
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def no_auto_correct!
|
30
|
+
@config[:auto_correct] = false
|
31
|
+
end
|
32
|
+
|
33
|
+
def load_config
|
34
|
+
yield
|
35
|
+
rescue RuboCop::Error => e
|
36
|
+
say_abort "[Config] #{e}"
|
37
|
+
rescue TypeError => e
|
38
|
+
say_abort "[Config] #{e}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def lint_mode!
|
42
|
+
@config[:auto_correct] = false
|
43
|
+
if old?
|
44
|
+
@config[:fail_level] = :warning
|
45
|
+
end
|
46
|
+
load_untracked!
|
47
|
+
end
|
48
|
+
|
16
49
|
def git_version
|
17
50
|
cmd("git --version").last.split(/\s+/, 3).last
|
18
51
|
end
|
@@ -36,6 +69,16 @@ module Rfix
|
|
36
69
|
def init!
|
37
70
|
@files ||= {}
|
38
71
|
@global_enable = false
|
72
|
+
@config = {
|
73
|
+
color: true,
|
74
|
+
force_exclusion: true,
|
75
|
+
auto_correct: true,
|
76
|
+
formatters: ["Rfix::Formatter"]
|
77
|
+
}
|
78
|
+
|
79
|
+
if old?
|
80
|
+
@config[:fail_level] = :autocorrect
|
81
|
+
end
|
39
82
|
end
|
40
83
|
|
41
84
|
def files
|
@@ -100,6 +143,12 @@ module Rfix
|
|
100
143
|
|
101
144
|
private
|
102
145
|
|
146
|
+
def old?
|
147
|
+
# For version 0.80.x .. 0.83.x:
|
148
|
+
# Otherwise it will exit with status code = 1
|
149
|
+
(0.80..0.83).include?(RuboCop::Version::STRING.to_f)
|
150
|
+
end
|
151
|
+
|
103
152
|
def get_file(path, &block)
|
104
153
|
if file = @files[path]
|
105
154
|
block.call(file)
|
data/lib/rfix/version.rb
CHANGED
data/rfix.gemspec
CHANGED
@@ -18,7 +18,18 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.email = ["linus@oleander.nu"]
|
19
19
|
|
20
20
|
spec.summary = "RuboCop CLI that only complains about your latest changes"
|
21
|
-
spec.description =
|
21
|
+
spec.description = <<~TEXT
|
22
|
+
#{spec.summary}
|
23
|
+
Uses 'git diff' to determine what changes were made then runs RuboCop against them
|
24
|
+
|
25
|
+
$ rfix branch <branch> -- Fix changes made between HEAD and <branch>
|
26
|
+
$ rfix origin -- Fix changes made between HEAD and origin branch
|
27
|
+
$ rfix local -- Fix changes not yet pushed to upstream branch
|
28
|
+
$ rfix info -- Display runtime dependencies and their versions
|
29
|
+
$ rfix all -- Fix all files in this repository (not recommended)
|
30
|
+
|
31
|
+
Optional args: --dry --help --list-files --limit-files --config --untracked
|
32
|
+
TEXT
|
22
33
|
spec.homepage = "https://github.com/oleander/rfix-rb"
|
23
34
|
spec.license = "MIT"
|
24
35
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
@@ -37,6 +48,8 @@ Gem::Specification.new do |spec|
|
|
37
48
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
38
49
|
spec.require_paths = ["lib", "vendor/cli-ui/lib"]
|
39
50
|
|
51
|
+
spec.requirements << "git, v2.0+"
|
52
|
+
|
40
53
|
spec.add_runtime_dependency "rainbow", "~> 3.0"
|
41
54
|
spec.add_runtime_dependency "rouge", "~> 3.20"
|
42
55
|
spec.add_runtime_dependency "rubocop", "~> 0.80"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7.pre.67
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Linus Oleander
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -52,7 +52,14 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.80'
|
55
|
-
description: "
|
55
|
+
description: "RuboCop CLI that only complains about your latest changes\nUses 'git
|
56
|
+
diff' to determine what changes were made then runs RuboCop against them\n\n\t$
|
57
|
+
rfix branch <branch> -- Fix changes made between HEAD and <branch>\n\t$ rfix origin
|
58
|
+
\ -- Fix changes made between HEAD and origin branch\n\t$ rfix local --
|
59
|
+
Fix changes not yet pushed to upstream branch\n\t$ rfix info -- Display
|
60
|
+
runtime dependencies and their versions\n\t$ rfix all -- Fix all files
|
61
|
+
in this repository (not recommended)\n\nOptional args: --dry --help --list-files
|
62
|
+
--limit-files --config --untracked\n"
|
56
63
|
email:
|
57
64
|
- linus@oleander.nu
|
58
65
|
executables:
|
@@ -89,7 +96,8 @@ files:
|
|
89
96
|
- exe/rfix
|
90
97
|
- lib/rfix.rb
|
91
98
|
- lib/rfix/cmd.rb
|
92
|
-
- lib/rfix/extensions.rb
|
99
|
+
- lib/rfix/extensions/extensions.rb
|
100
|
+
- lib/rfix/extensions/offense.rb
|
93
101
|
- lib/rfix/formatter.rb
|
94
102
|
- lib/rfix/git_file.rb
|
95
103
|
- lib/rfix/git_helper.rb
|
@@ -144,7 +152,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
152
|
- - ">"
|
145
153
|
- !ruby/object:Gem::Version
|
146
154
|
version: 1.3.1
|
147
|
-
requirements:
|
155
|
+
requirements:
|
156
|
+
- git, v2.0+
|
148
157
|
rubygems_version: 3.0.3
|
149
158
|
signing_key:
|
150
159
|
specification_version: 4
|
data/lib/rfix/extensions.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rubocop"
|
4
|
-
require "rainbow"
|
5
|
-
|
6
|
-
module Rfix::Ext
|
7
|
-
module CommentConfig
|
8
|
-
# Called by RuboCop on every line to see
|
9
|
-
# if its suppose to run against it or not
|
10
|
-
def cop_enabled_at_line?(_cop, line)
|
11
|
-
Rfix.enabled?(processed_source.file_path, line) && super
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
module Runner
|
16
|
-
# Called _after_ @source has been 'auto fixed' by Rubocop
|
17
|
-
def check_for_infinite_loop(source, offences)
|
18
|
-
Rfix.refresh!(source); super # TODO: Before or after?
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module Options
|
23
|
-
# Appends custom --args to RuboCop CLI
|
24
|
-
def define_options
|
25
|
-
super.tap do |options|
|
26
|
-
@ons.each do |args, block|
|
27
|
-
option(options, *args, &block)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Helper method used by rfix to append cli --args to Rubocop
|
33
|
-
def on(*args, &block)
|
34
|
-
@ons ||= []
|
35
|
-
@ons += [[args, block]]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
module Offense
|
40
|
-
def where
|
41
|
-
line.to_s + ":" + real_column.to_s
|
42
|
-
end
|
43
|
-
|
44
|
-
def info
|
45
|
-
message.split(": ", 2).last.delete("\n")
|
46
|
-
end
|
47
|
-
|
48
|
-
def msg
|
49
|
-
CLI::UI.resolve_text("{{italic:#{info}}}", truncate_to: CLI::UI::Terminal.width - 10)
|
50
|
-
end
|
51
|
-
|
52
|
-
def code
|
53
|
-
message.split(": ", 2).first
|
54
|
-
end
|
55
|
-
|
56
|
-
def star
|
57
|
-
Rainbow("⭑")
|
58
|
-
end
|
59
|
-
|
60
|
-
def cross
|
61
|
-
Rainbow("✗")
|
62
|
-
end
|
63
|
-
|
64
|
-
def check
|
65
|
-
Rainbow("✓")
|
66
|
-
end
|
67
|
-
|
68
|
-
def level
|
69
|
-
colors = {
|
70
|
-
refactor: star.lightcyan,
|
71
|
-
convention: star.lightblue,
|
72
|
-
warning: star.lightyellow,
|
73
|
-
error: cross.indianred,
|
74
|
-
fatal: cross.lightsalmon
|
75
|
-
}
|
76
|
-
|
77
|
-
colors[severity.name]
|
78
|
-
end
|
79
|
-
|
80
|
-
def icon
|
81
|
-
return check.green if corrected?
|
82
|
-
return check.lightgreen if correctable?
|
83
|
-
|
84
|
-
cross.indianred
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
RuboCop::Options.prepend(Rfix::Ext::Options)
|
90
|
-
RuboCop::Runner.prepend(Rfix::Ext::Runner)
|
91
|
-
RuboCop::CommentConfig.prepend(Rfix::Ext::CommentConfig)
|
92
|
-
RuboCop::Cop::Offense.prepend(Rfix::Ext::Offense)
|