class RuboCop::Cop::Offense
Constants
- CHECK
- CIRCLE
- CROSS
- STAR
concerning :Features do
Public Instance Methods
clickable_path(root_path)
click to toggle source
# File lib/rfix/extension/offense.rb, line 45 def clickable_path(root_path) Rainbow("#{relative_path(root_path)}:#{where}").italic end
clickable_plain_severity()
click to toggle source
# File lib/rfix/extension/offense.rb, line 59 def clickable_plain_severity TTY::Link.link_to(cop_name, href) end
clickable_severity()
click to toggle source
# File lib/rfix/extension/offense.rb, line 63 def clickable_severity clickable_plain_severity && Rainbow(clickable_plain_severity).italic end
code()
click to toggle source
# File lib/rfix/extension/offense.rb, line 35 def code message.split(": ", 2).first end
escape(str)
click to toggle source
# File lib/rfix/extension/offense.rb, line 76 def escape(str) Shellwords.escape(str) end
href()
click to toggle source
# File lib/rfix/extension/offense.rb, line 49 def href cop_name.split("/", 2).then do |department, cop| return nil if [cop, department].any?(&:nil?) { type: department.parameterize, cop: cop.parameterize } end.then do |options| "https://docs.rubocop.org/rubocop/cops_%<type>s.html#%<type>s%<cop>s" % options end end
icon()
click to toggle source
# File lib/rfix/extension/offense.rb, line 67 def icon { uncorrected: CIRCLE, unsupported: CROSS, correctable: STAR, corrected: CHECK }.fetch(status) end
info()
click to toggle source
# File lib/rfix/extension/offense.rb, line 27 def info message.split(": ", 2).last.delete("\n") end
msg()
click to toggle source
# File lib/rfix/extension/offense.rb, line 31 def msg Rainbow(info).italic end
relative_path(root_path)
click to toggle source
# File lib/rfix/extension/offense.rb, line 39 def relative_path(root_path) return EMPTY_STRING unless location.respond_to?(:source_buffer) Pathname(location.source_buffer.name).relative_path_from(root_path) end
where()
click to toggle source
# File lib/rfix/extension/offense.rb, line 23 def where "#{line}:#{real_column}" end