Class: RuboCop::CLI::Command::SuggestExtensions Private

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cli/command/suggest_extensions.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Suggest RuboCop extensions to install based on Gemfile dependencies. Only primary dependencies are evaluated, so if a dependency depends on a gem with an extension, it is not suggested. However, if an extension is a transitive dependency, it will not be suggested.

Constant Summary collapse

INCLUDED_FORMATTERS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Combination of short and long formatter names.

%w[p progress fu fuubar pa pacman].freeze

Instance Attribute Summary

Attributes inherited from Base

#env

Instance Method Summary collapse

Methods inherited from Base

by_command_name, inherited, #initialize

Constructor Details

This class inherits a constructor from RuboCop::CLI::Command::Base

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rubocop/cli/command/suggest_extensions.rb', line 17

def run
  return if skip? || extensions.none?

  puts
  puts 'Tip: Based on detected gems, the following '\
       'RuboCop extension libraries might be helpful:'

  extensions.sort.each do |extension|
    puts "  * #{extension} (https://github.com/rubocop/#{extension})"
  end

  puts
  puts 'You can opt out of this message by adding the following to your config '\
       '(see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions '\
       'for more options):'
  puts '  AllCops:'
  puts '    SuggestExtensions: false'

  puts if @options[:display_time]
end