Skip to content

Commit 0e800c1

Browse files
authored
Merge pull request #58 from lxxxvi/update-require-with-plugins
Update require with plugins
2 parents 92c1343 + 17d7bd5 commit 0e800c1

11 files changed

+18
-18
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
**ruboclean** puts `.rubocop.yml` into order. It groups the configuration into three groups:
88

9-
1. "Base"-configuration like `require`, `inherit_from`, etc.
9+
1. "Base"-configuration like `plugins`, `inherit_from`, etc.
1010
2. `Namespaces`
1111
3. `Namespace/Cops`
1212

@@ -34,7 +34,7 @@ AllCops:
3434
- path_without_files/**/* # Will be removed if no files within pattern exist. Skip with --preserve-paths option.
3535

3636
# Preceding comments will be removed unless the --preserve-comments option is used.
37-
require:
37+
plugins:
3838
- rubocop-rails # Inline comments will always be removed.
3939
```
4040
@@ -43,7 +43,7 @@ require:
4343
```yml
4444
---
4545
46-
require:
46+
plugins:
4747
- rubocop-rails
4848
4949
AllCops:

lib/ruboclean/grouper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Ruboclean
44
# Groups the rubocop configuration items into three categories:
5-
# - base: base configuration like 'require', 'inherit_from', etc
5+
# - base: base configuration like 'plugins', 'inherit_from', etc
66
# - namespaces: every item which does **not** include an "/"
77
# - cops: every item which **includes** an "/"
88
class Grouper

test/fixtures/00_expected_output.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
inherit_from:
44
- shared.yml
55

6-
require:
6+
plugins:
77
- rubocop-rails
88

99
AllCops:

test/fixtures/00_expected_output_with_preserved_comments.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
inherit_from:
55
- shared.yml
66

7-
# preceding require: comment, wrongly indented
8-
require:
7+
# preceding plugins: comment, wrongly indented
8+
plugins:
99
- rubocop-rails
1010

1111
# multiline

test/fixtures/00_expected_output_with_preserved_paths.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
inherit_from:
44
- shared.yml
55

6-
require:
6+
plugins:
77
- rubocop-rails
88

99
AllCops:

test/fixtures/00_input.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ AllCops:
2525
- file_exists.rb
2626
- subdirectory/file_exists.rb
2727

28-
# preceding require: comment, wrongly indented
29-
require:
28+
# preceding plugins: comment, wrongly indented
29+
plugins:
3030
- rubocop-rails
3131

3232

test/fixtures/01_expected_output_without_require_block.yml renamed to test/fixtures/01_expected_output_without_plugins_block.yml

File renamed without changes.
File renamed without changes.

test/ruboclean/grouper_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_group_config_with_empty_configuration
1616
end
1717

1818
def test_group_config_only_base
19-
config_hash = { "require" => ["rubocop-rails"] }
19+
config_hash = { "plugins" => ["rubocop-rails"] }
2020

2121
group_config_with(config_hash).tap do |result|
2222
assert_equal 3, result.keys.size

test/ruboclean/orderer_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ module Ruboclean
66
class OrdererTest < BaseTest
77
def test_order_all
88
input = { "Foo/Foo" => nil, "Foo/Faa" => nil, "Baz" => nil,
9-
"Bar" => nil, "require" => nil, "inherit_from" => nil }
10-
output = { "inherit_from" => nil, "require" => nil, "Bar" => nil,
9+
"Bar" => nil, "plugins" => nil, "inherit_from" => nil }
10+
output = { "inherit_from" => nil, "plugins" => nil, "Bar" => nil,
1111
"Baz" => nil, "Foo/Faa" => nil, "Foo/Foo" => nil }
1212

1313
assert_ordered input, output
@@ -28,8 +28,8 @@ def test_order_without_namespaces
2828
end
2929

3030
def test_order_without_cops
31-
input = { "Baz" => nil, "Bar" => nil, "require" => nil }
32-
output = { "require" => nil, "Bar" => nil, "Baz" => nil }
31+
input = { "Baz" => nil, "Bar" => nil, "plugins" => nil }
32+
output = { "plugins" => nil, "Bar" => nil, "Baz" => nil }
3333

3434
assert_ordered input, output
3535
end

0 commit comments

Comments
 (0)