Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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.
```

Expand All @@ -43,7 +43,7 @@ require:
```yml
---

require:
plugins:
- rubocop-rails

AllCops:
Expand Down
2 changes: 1 addition & 1 deletion lib/ruboclean/grouper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/00_expected_output.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
inherit_from:
- shared.yml

require:
plugins:
- rubocop-rails

AllCops:
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/00_expected_output_with_preserved_comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
inherit_from:
- shared.yml

# preceding require: comment, wrongly indented
require:
# preceding plugins: comment, wrongly indented
plugins:
- rubocop-rails

# multiline
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/00_expected_output_with_preserved_paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
inherit_from:
- shared.yml

require:
plugins:
- rubocop-rails

AllCops:
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/00_input.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion test/ruboclean/grouper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions test/ruboclean/orderer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/ruboclean/runner_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down