diff --git a/changelog/fix_restore_rubocop_config_loader_project_root.md b/changelog/fix_restore_rubocop_config_loader_project_root.md new file mode 100644 index 00000000000..d6842c48d6c --- /dev/null +++ b/changelog/fix_restore_rubocop_config_loader_project_root.md @@ -0,0 +1 @@ +* [#10871](https://github.com/rubocop/rubocop/issues/10871): Restore `RuboCop::ConfigLoader.project_root` as deprecated. ([@koic][]) diff --git a/lib/rubocop/config_loader.rb b/lib/rubocop/config_loader.rb index 6bbcdcf3b16..f594843f52a 100644 --- a/lib/rubocop/config_loader.rb +++ b/lib/rubocop/config_loader.rb @@ -137,6 +137,18 @@ def default_configuration end end + # Returns the path RuboCop inferred as the root of the project. No file + # searches will go past this directory. + # @deprecated Use `RuboCop::ConfigFinder.project_root` instead. + def project_root + warn Rainbow(<<~WARNING).yellow + `RuboCop::ConfigLoader.project_root` is deprecated and will be removed in RuboCop 2.0. \ + Use `RuboCop::ConfigFinder.project_root` instead. + WARNING + + ConfigFinder.project_root + end + PENDING_BANNER = <<~BANNER The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.