diff --git a/README.md b/README.md index dcd2aa5..7c0b8ef 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ **ruboclean** puts `.rubocop.yml` into order. It groups the configuration into three groups: -1. "Base"-configuration like `require`, `inherit_from`, etc. +1. "Base"-configuration like `plugins`, `inherit_from`, etc. 2. `Namespaces` 3. `Namespace/Cops` @@ -34,7 +34,7 @@ AllCops: - path_without_files/**/* # Will be removed if no files within pattern exist. Skip with --preserve-paths option. # Preceding comments will be removed unless the --preserve-comments option is used. -require: +plugins: - rubocop-rails # Inline comments will always be removed. ``` @@ -43,7 +43,7 @@ require: ```yml --- -require: +plugins: - rubocop-rails AllCops: diff --git a/lib/ruboclean/grouper.rb b/lib/ruboclean/grouper.rb index edd6bc2..ee540e8 100644 --- a/lib/ruboclean/grouper.rb +++ b/lib/ruboclean/grouper.rb @@ -2,7 +2,7 @@ module Ruboclean # Groups the rubocop configuration items into three categories: - # - base: base configuration like 'require', 'inherit_from', etc + # - base: base configuration like 'plugins', 'inherit_from', etc # - namespaces: every item which does **not** include an "/" # - cops: every item which **includes** an "/" class Grouper diff --git a/test/fixtures/00_expected_output.yml b/test/fixtures/00_expected_output.yml index 24b80c3..7b18718 100644 --- a/test/fixtures/00_expected_output.yml +++ b/test/fixtures/00_expected_output.yml @@ -3,7 +3,7 @@ inherit_from: - shared.yml -require: +plugins: - rubocop-rails AllCops: diff --git a/test/fixtures/00_expected_output_with_preserved_comments.yml b/test/fixtures/00_expected_output_with_preserved_comments.yml index 76c0d1e..1a8307c 100644 --- a/test/fixtures/00_expected_output_with_preserved_comments.yml +++ b/test/fixtures/00_expected_output_with_preserved_comments.yml @@ -4,8 +4,8 @@ inherit_from: - shared.yml -# preceding require: comment, wrongly indented -require: +# preceding plugins: comment, wrongly indented +plugins: - rubocop-rails # multiline diff --git a/test/fixtures/00_expected_output_with_preserved_paths.yml b/test/fixtures/00_expected_output_with_preserved_paths.yml index 1081ee1..eea17fa 100644 --- a/test/fixtures/00_expected_output_with_preserved_paths.yml +++ b/test/fixtures/00_expected_output_with_preserved_paths.yml @@ -3,7 +3,7 @@ inherit_from: - shared.yml -require: +plugins: - rubocop-rails AllCops: diff --git a/test/fixtures/00_input.yml b/test/fixtures/00_input.yml index bb47ad1..b342173 100644 --- a/test/fixtures/00_input.yml +++ b/test/fixtures/00_input.yml @@ -25,8 +25,8 @@ AllCops: - file_exists.rb - subdirectory/file_exists.rb - # preceding require: comment, wrongly indented -require: + # preceding plugins: comment, wrongly indented +plugins: - rubocop-rails diff --git a/test/fixtures/01_expected_output_without_require_block.yml b/test/fixtures/01_expected_output_without_plugins_block.yml similarity index 100% rename from test/fixtures/01_expected_output_without_require_block.yml rename to test/fixtures/01_expected_output_without_plugins_block.yml diff --git a/test/fixtures/01_input_without_require_block.yml b/test/fixtures/01_input_without_plugins_block.yml similarity index 100% rename from test/fixtures/01_input_without_require_block.yml rename to test/fixtures/01_input_without_plugins_block.yml diff --git a/test/ruboclean/grouper_test.rb b/test/ruboclean/grouper_test.rb index c27d7ab..10767af 100644 --- a/test/ruboclean/grouper_test.rb +++ b/test/ruboclean/grouper_test.rb @@ -16,7 +16,7 @@ def test_group_config_with_empty_configuration end def test_group_config_only_base - config_hash = { "require" => ["rubocop-rails"] } + config_hash = { "plugins" => ["rubocop-rails"] } group_config_with(config_hash).tap do |result| assert_equal 3, result.keys.size diff --git a/test/ruboclean/orderer_test.rb b/test/ruboclean/orderer_test.rb index 9bcf3c0..e46bcd3 100644 --- a/test/ruboclean/orderer_test.rb +++ b/test/ruboclean/orderer_test.rb @@ -6,8 +6,8 @@ module Ruboclean class OrdererTest < BaseTest def test_order_all input = { "Foo/Foo" => nil, "Foo/Faa" => nil, "Baz" => nil, - "Bar" => nil, "require" => nil, "inherit_from" => nil } - output = { "inherit_from" => nil, "require" => nil, "Bar" => nil, + "Bar" => nil, "plugins" => nil, "inherit_from" => nil } + output = { "inherit_from" => nil, "plugins" => nil, "Bar" => nil, "Baz" => nil, "Foo/Faa" => nil, "Foo/Foo" => nil } assert_ordered input, output @@ -28,8 +28,8 @@ def test_order_without_namespaces end def test_order_without_cops - input = { "Baz" => nil, "Bar" => nil, "require" => nil } - output = { "require" => nil, "Bar" => nil, "Baz" => nil } + input = { "Baz" => nil, "Bar" => nil, "plugins" => nil } + output = { "plugins" => nil, "Bar" => nil, "Baz" => nil } assert_ordered input, output end diff --git a/test/ruboclean/runner_test.rb b/test/ruboclean/runner_test.rb index 07c1d1e..8951321 100644 --- a/test/ruboclean/runner_test.rb +++ b/test/ruboclean/runner_test.rb @@ -90,13 +90,13 @@ def test_run_with_directory_path_that_does_not_have_rubocop_yaml assert_equal "input path does not exist: '/tmp/.rubocop.yml'", error.message end - def test_run_without_require_block - using_fixture_files("01_input_without_require_block.yml") do |fixture_path| + def test_run_without_plugins_block + using_fixture_files("01_input_without_plugins_block.yml") do |fixture_path| arguments = [fixture_path] Ruboclean::Runner.new(arguments).run! assert_equal( - fixture_file_path("01_expected_output_without_require_block.yml").read, + fixture_file_path("01_expected_output_without_plugins_block.yml").read, Pathname.new(fixture_path).read ) end