Class: RuboCop::ConfigFinder Private

Inherits:
Object
  • Object
show all
Extended by:
FileFinder
Defined in:
lib/rubocop/config_finder.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.

This class has methods related to finding configuration path.

Constant Summary collapse

DOTFILE =

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.

'.rubocop.yml'
XDG_CONFIG =

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.

'config.yml'
RUBOCOP_HOME =

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.

File.realpath(File.join(File.dirname(__FILE__), '..', '..'))
DEFAULT_FILE =

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.

File.join(RUBOCOP_HOME, 'config', 'default.yml')

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from FileFinder

find_file_upwards, find_last_file_upwards, traverse_directories_upwards

Class Attribute Details

.project_rootObject

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.

Returns the path RuboCop inferred as the root of the project. No file searches will go past this directory.



26
27
28
# File 'lib/rubocop/config_finder.rb', line 26

def project_root
  @project_root ||= find_project_root
end

Class Method Details

.find_config_path(target_dir) ⇒ Object

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.



19
20
21
22
# File 'lib/rubocop/config_finder.rb', line 19

def find_config_path(target_dir)
  find_project_dotfile(target_dir) || find_project_root_dot_config ||
    find_user_dotfile || find_user_xdg_config || DEFAULT_FILE
end