diff --git a/lib/rubocop/cop/bundler/duplicated_gem.rb b/lib/rubocop/cop/bundler/duplicated_gem.rb index dffcea62742d..546ed45b078c 100644 --- a/lib/rubocop/cop/bundler/duplicated_gem.rb +++ b/lib/rubocop/cop/bundler/duplicated_gem.rb @@ -46,11 +46,7 @@ def on_new_investigation duplicated_gem_nodes.each do |nodes| nodes[1..-1].each do |node| - register_offense( - node, - node.first_argument.to_a.first, - nodes.first.first_line - ) + register_offense(node, node.first_argument.to_a.first, nodes.first.first_line) end end end diff --git a/lib/rubocop/cop/gemspec/duplicated_assignment.rb b/lib/rubocop/cop/gemspec/duplicated_assignment.rb index 8bd10fe01574..1edc54bda8b8 100644 --- a/lib/rubocop/cop/gemspec/duplicated_assignment.rb +++ b/lib/rubocop/cop/gemspec/duplicated_assignment.rb @@ -52,11 +52,7 @@ def on_new_investigation duplicated_assignment_method_nodes.each do |nodes| nodes[1..-1].each do |node| - register_offense( - node, - node.method_name, - nodes.first.first_line - ) + register_offense(node, node.method_name, nodes.first.first_line) end end end diff --git a/lib/rubocop/cop/layout/indentation_width.rb b/lib/rubocop/cop/layout/indentation_width.rb index 495accf8edca..a4abac2e9e4e 100644 --- a/lib/rubocop/cop/layout/indentation_width.rb +++ b/lib/rubocop/cop/layout/indentation_width.rb @@ -185,8 +185,7 @@ def select_check_member(member) def check_members_for_indented_internal_methods_style(members) each_member(members) do |member, previous_modifier| - check_indentation(previous_modifier, member, - indentation_consistency_style) + check_indentation(previous_modifier, member, indentation_consistency_style) end end diff --git a/lib/rubocop/cop/lint/syntax.rb b/lib/rubocop/cop/lint/syntax.rb index 2eb862a61030..c294dcf31426 100644 --- a/lib/rubocop/cop/lint/syntax.rb +++ b/lib/rubocop/cop/lint/syntax.rb @@ -9,8 +9,7 @@ class Syntax < Base def on_other_file add_offense_from_error(processed_source.parser_error) if processed_source.parser_error processed_source.diagnostics.each do |diagnostic| - add_offense_from_diagnostic(diagnostic, - processed_source.ruby_version) + add_offense_from_diagnostic(diagnostic, processed_source.ruby_version) end super end diff --git a/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb b/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb index f6a43b97ecb1..fa48be20ae88 100644 --- a/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +++ b/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb @@ -101,8 +101,7 @@ def compound_assignment(node) children = node.masgn_type? ? node.children[0].children : node.children will_be_miscounted = children.count do |child| - child.respond_to?(:setter_method?) && - !child.setter_method? + child.respond_to?(:setter_method?) && !child.setter_method? end @assignment += will_be_miscounted diff --git a/lib/rubocop/cop/mixin/multiline_expression_indentation.rb b/lib/rubocop/cop/mixin/multiline_expression_indentation.rb index 30911dab0518..fee6dd7fcf62 100644 --- a/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +++ b/lib/rubocop/cop/mixin/multiline_expression_indentation.rb @@ -196,8 +196,7 @@ def assignment_rhs(node) def not_for_this_cop?(node) node.ancestors.any? do |ancestor| - grouped_expression?(ancestor) || - inside_arg_list_parentheses?(node, ancestor) + grouped_expression?(ancestor) || inside_arg_list_parentheses?(node, ancestor) end end diff --git a/lib/rubocop/cop/style/empty_case_condition.rb b/lib/rubocop/cop/style/empty_case_condition.rb index 553634d63c3e..8b480e538634 100644 --- a/lib/rubocop/cop/style/empty_case_condition.rb +++ b/lib/rubocop/cop/style/empty_case_condition.rb @@ -47,8 +47,7 @@ def on_case(case_node) branch_bodies = [*case_node.when_branches.map(&:body), case_node.else_branch].compact return if branch_bodies.any? do |body| - body.return_type? || - body.each_descendant.any?(&:return_type?) + body.return_type? || body.each_descendant.any?(&:return_type?) end add_offense(case_node.loc.keyword) { |corrector| autocorrect(corrector, case_node) } diff --git a/lib/rubocop/cop/style/redundant_capital_w.rb b/lib/rubocop/cop/style/redundant_capital_w.rb index 0b4a7e75193c..b6508e25aab8 100644 --- a/lib/rubocop/cop/style/redundant_capital_w.rb +++ b/lib/rubocop/cop/style/redundant_capital_w.rb @@ -37,8 +37,7 @@ def on_percent_literal(node) def requires_interpolation?(node) node.child_nodes.any? do |string| - string.dstr_type? || - double_quotes_required?(string.source) + string.dstr_type? || double_quotes_required?(string.source) end end end diff --git a/lib/rubocop/cop/style/ternary_parentheses.rb b/lib/rubocop/cop/style/ternary_parentheses.rb index 8dcdf49f52c5..dac08bd69e3e 100644 --- a/lib/rubocop/cop/style/ternary_parentheses.rb +++ b/lib/rubocop/cop/style/ternary_parentheses.rb @@ -184,8 +184,7 @@ def infinite_loop? def unsafe_autocorrect?(condition) condition.children.any? do |child| - unparenthesized_method_call?(child) || - below_ternary_precedence?(child) + unparenthesized_method_call?(child) || below_ternary_precedence?(child) end end diff --git a/lib/rubocop/cop/style/trailing_method_end_statement.rb b/lib/rubocop/cop/style/trailing_method_end_statement.rb index 07a9809639a8..d1818aaf7342 100644 --- a/lib/rubocop/cop/style/trailing_method_end_statement.rb +++ b/lib/rubocop/cop/style/trailing_method_end_statement.rb @@ -42,10 +42,7 @@ def on_def(node) return if node.endless? || !trailing_end?(node) add_offense(node.loc.end) do |corrector| - corrector.insert_before( - node.loc.end, - "\n#{' ' * node.loc.keyword.column}" - ) + corrector.insert_before(node.loc.end, "\n#{' ' * node.loc.keyword.column}") end end diff --git a/lib/rubocop/formatter/offense_count_formatter.rb b/lib/rubocop/formatter/offense_count_formatter.rb index bd75ed552623..ee735515578d 100644 --- a/lib/rubocop/formatter/offense_count_formatter.rb +++ b/lib/rubocop/formatter/offense_count_formatter.rb @@ -52,8 +52,7 @@ def report_summary(offense_counts) output.puts per_cop_counts.each do |cop_name, count| - output.puts "#{count.to_s.ljust(total_count.to_s.length + 2)}" \ - "#{cop_name}\n" + output.puts "#{count.to_s.ljust(total_count.to_s.length + 2)}#{cop_name}\n" end output.puts '--' output.puts "#{total_count} Total" diff --git a/lib/rubocop/formatter/worst_offenders_formatter.rb b/lib/rubocop/formatter/worst_offenders_formatter.rb index 10ffa6fb1a37..a3b085391b77 100644 --- a/lib/rubocop/formatter/worst_offenders_formatter.rb +++ b/lib/rubocop/formatter/worst_offenders_formatter.rb @@ -40,8 +40,7 @@ def report_summary(offense_counts) output.puts per_file_counts.each do |file_name, count| - output.puts "#{count.to_s.ljust(total_count.to_s.length + 2)}" \ - "#{file_name}\n" + output.puts "#{count.to_s.ljust(total_count.to_s.length + 2)}#{file_name}\n" end output.puts '--' output.puts "#{total_count} Total" diff --git a/spec/project_spec.rb b/spec/project_spec.rb index 251439db9a7c..9a8097f6e7da 100644 --- a/spec/project_spec.rb +++ b/spec/project_spec.rb @@ -199,10 +199,7 @@ def expected describe 'body' do let(:bodies) do entries.map do |entry| - entry - .gsub(/`[^`]+`/, '``') - .sub(/^\*\s*(?:\[.+?\):\s*)?/, '') - .sub(/\s*\([^)]+\)$/, '') + entry.gsub(/`[^`]+`/, '``').sub(/^\*\s*(?:\[.+?\):\s*)?/, '').sub(/\s*\([^)]+\)$/, '') end end diff --git a/spec/rubocop/cli/autocorrect_spec.rb b/spec/rubocop/cli/autocorrect_spec.rb index 2da23f3361f0..17c1d3fea2c7 100644 --- a/spec/rubocop/cli/autocorrect_spec.rb +++ b/spec/rubocop/cli/autocorrect_spec.rb @@ -702,8 +702,7 @@ def verify_section describe 'caching' do let(:cache) do - instance_double(RuboCop::ResultCache, 'valid?' => true, - 'load' => cached_offenses) + instance_double(RuboCop::ResultCache, 'valid?' => true, 'load' => cached_offenses) end let(:source) { %(puts "Hi"\n) } diff --git a/spec/rubocop/cli/options_spec.rb b/spec/rubocop/cli/options_spec.rb index e965d710c376..d9c26c52b902 100644 --- a/spec/rubocop/cli/options_spec.rb +++ b/spec/rubocop/cli/options_spec.rb @@ -1260,8 +1260,7 @@ def full_description_of_cop(cop) context 'and offenses come from the cache' do context 'and a message has binary encoding' do let(:message_from_cache) do - (+'Cyclomatic complexity for 文 is too high. [8/6]') - .force_encoding('ASCII-8BIT') + (+'Cyclomatic complexity for 文 is too high. [8/6]').force_encoding('ASCII-8BIT') end let(:data_from_cache) do [ diff --git a/spec/rubocop/cop/commissioner_spec.rb b/spec/rubocop/cop/commissioner_spec.rb index b7a4440f7d7b..c39454ebc7fb 100644 --- a/spec/rubocop/cop/commissioner_spec.rb +++ b/spec/rubocop/cop/commissioner_spec.rb @@ -35,8 +35,7 @@ def method let(:processed_source) { parse_source(source, 'file.rb') } let(:cop_offenses) { [] } let(:cop_report) do - RuboCop::Cop::Base::InvestigationReport - .new(nil, processed_source, cop_offenses, nil) + RuboCop::Cop::Base::InvestigationReport.new(nil, processed_source, cop_offenses, nil) end around { |example| RuboCop::Cop::Registry.with_temporary_global { example.run } } diff --git a/spec/rubocop/cop/cop_spec.rb b/spec/rubocop/cop/cop_spec.rb index aa941e6d7e34..a33f2c37148e 100644 --- a/spec/rubocop/cop/cop_spec.rb +++ b/spec/rubocop/cop/cop_spec.rb @@ -102,8 +102,7 @@ end before do - allow(processed_source.comment_config).to receive(:cop_enabled_at_line?) - .and_return(false) + allow(processed_source.comment_config).to receive(:cop_enabled_at_line?).and_return(false) end context 'ignore_disable_comments is false' do diff --git a/spec/rubocop/cop/generator/require_file_injector_spec.rb b/spec/rubocop/cop/generator/require_file_injector_spec.rb index fdfad4e79b48..23faba0dc7da 100644 --- a/spec/rubocop/cop/generator/require_file_injector_spec.rb +++ b/spec/rubocop/cop/generator/require_file_injector_spec.rb @@ -4,11 +4,7 @@ let(:stdout) { StringIO.new } let(:root_file_path) { 'lib/root.rb' } let(:injector) do - described_class.new( - source_path: source_path, - root_file_path: root_file_path, - output: stdout - ) + described_class.new(source_path: source_path, root_file_path: root_file_path, output: stdout) end around do |example| diff --git a/spec/rubocop/cop/layout/line_end_string_concatenation_indentation_spec.rb b/spec/rubocop/cop/layout/line_end_string_concatenation_indentation_spec.rb index b13f2d5e70bb..05ca764be14c 100644 --- a/spec/rubocop/cop/layout/line_end_string_concatenation_indentation_spec.rb +++ b/spec/rubocop/cop/layout/line_end_string_concatenation_indentation_spec.rb @@ -173,9 +173,7 @@ def some_method ['X =', '$x =', '@x =', 'x =', 'x +=', 'x ||='].each do |lhs_and_operator| context "for assignment with #{lhs_and_operator}" do let(:aligned_strings) do - [%(#{lhs_and_operator} "a" \\), - "#{' ' * lhs_and_operator.length} 'b'", - ''].join("\n") + [%(#{lhs_and_operator} "a" \\), "#{' ' * lhs_and_operator.length} 'b'", ''].join("\n") end it 'accepts aligned strings' do @@ -263,9 +261,7 @@ def some_method ['X =', '$x =', '@x =', 'x =', 'x +=', 'x ||='].each do |lhs_and_operator| context "for assignment with #{lhs_and_operator}" do let(:indented_strings) do - [%(#{lhs_and_operator} "a" \\), - " 'b'", - ''].join("\n") + [%(#{lhs_and_operator} "a" \\), " 'b'", ''].join("\n") end it 'accepts indented strings' do diff --git a/spec/rubocop/cop/layout/redundant_line_break_spec.rb b/spec/rubocop/cop/layout/redundant_line_break_spec.rb index cd251359ec13..027b653eade3 100644 --- a/spec/rubocop/cop/layout/redundant_line_break_spec.rb +++ b/spec/rubocop/cop/layout/redundant_line_break_spec.rb @@ -123,39 +123,39 @@ it 'registers an offense for a method without parentheses on multiple lines' do expect_offense(<<~RUBY) - def resolve_inheritance_from_gems(hash) - gems = hash.delete('inherit_gem') - (gems || {}).each_pair do |gem_name, config_path| - if gem_name == 'rubocop' - raise ArgumentError, - ^^^^^^^^^^^^^^^^^^^^ Redundant line break detected. - "can't inherit configuration from the rubocop gem" - end - - hash['inherit_from'] = Array(hash['inherit_from']) - Array(config_path).reverse_each do |path| - # Put gem configuration first so local configuration overrides it. - hash['inherit_from'].unshift gem_config_path(gem_name, path) - end - end - end + def resolve_inheritance_from_gems(hash) + gems = hash.delete('inherit_gem') + (gems || {}).each_pair do |gem_name, config_path| + if gem_name == 'rubocop' + raise ArgumentError, + ^^^^^^^^^^^^^^^^^^^^ Redundant line break detected. + "can't inherit configuration from the rubocop gem" + end + + hash['inherit_from'] = Array(hash['inherit_from']) + Array(config_path).reverse_each do |path| + # Put gem configuration first so local configuration overrides it. + hash['inherit_from'].unshift gem_config_path(gem_name, path) + end + end + end RUBY expect_correction(<<~RUBY) - def resolve_inheritance_from_gems(hash) - gems = hash.delete('inherit_gem') - (gems || {}).each_pair do |gem_name, config_path| - if gem_name == 'rubocop' - raise ArgumentError, "can't inherit configuration from the rubocop gem" - end - - hash['inherit_from'] = Array(hash['inherit_from']) - Array(config_path).reverse_each do |path| - # Put gem configuration first so local configuration overrides it. - hash['inherit_from'].unshift gem_config_path(gem_name, path) - end - end - end + def resolve_inheritance_from_gems(hash) + gems = hash.delete('inherit_gem') + (gems || {}).each_pair do |gem_name, config_path| + if gem_name == 'rubocop' + raise ArgumentError, "can't inherit configuration from the rubocop gem" + end + + hash['inherit_from'] = Array(hash['inherit_from']) + Array(config_path).reverse_each do |path| + # Put gem configuration first so local configuration overrides it. + hash['inherit_from'].unshift gem_config_path(gem_name, path) + end + end + end RUBY end end diff --git a/spec/rubocop/cop/lint/multiple_comparison_spec.rb b/spec/rubocop/cop/lint/multiple_comparison_spec.rb index f0d3f2595c4a..873c81c956bb 100644 --- a/spec/rubocop/cop/lint/multiple_comparison_spec.rb +++ b/spec/rubocop/cop/lint/multiple_comparison_spec.rb @@ -15,8 +15,7 @@ end %w[< > <= >=].repeated_permutation(2) do |operator1, operator2| - include_examples 'Check to use two comparison operator', - operator1, operator2 + include_examples 'Check to use two comparison operator', operator1, operator2 end it 'accepts to use one compare operator' do diff --git a/spec/rubocop/cop/lint/void_spec.rb b/spec/rubocop/cop/lint/void_spec.rb index 8d6ee93902a9..5226d616c2e7 100644 --- a/spec/rubocop/cop/lint/void_spec.rb +++ b/spec/rubocop/cop/lint/void_spec.rb @@ -103,11 +103,7 @@ context 'when checking for methods with no side effects' do let(:config) do - RuboCop::Config.new( - 'Lint/Void' => { - 'CheckForMethodsWithNoSideEffects' => true - } - ) + RuboCop::Config.new('Lint/Void' => { 'CheckForMethodsWithNoSideEffects' => true }) end it 'registers an offense if not on last line' do @@ -129,11 +125,7 @@ context 'when not checking for methods with no side effects' do let(:config) do - RuboCop::Config.new( - 'Lint/Void' => { - 'CheckForMethodsWithNoSideEffects' => false - } - ) + RuboCop::Config.new('Lint/Void' => { 'CheckForMethodsWithNoSideEffects' => false }) end it 'does not register an offense for void nonmutating methods' do diff --git a/spec/rubocop/cop/message_annotator_spec.rb b/spec/rubocop/cop/message_annotator_spec.rb index 908e9927d7ba..0b4d8b4c2dc5 100644 --- a/spec/rubocop/cop/message_annotator_spec.rb +++ b/spec/rubocop/cop/message_annotator_spec.rb @@ -62,9 +62,7 @@ context 'when StyleGuide is set in the config' do let(:config) do - RuboCop::Config.new( - 'Cop/Cop' => { 'StyleGuide' => 'http://example.org/styleguide' } - ) + RuboCop::Config.new('Cop/Cop' => { 'StyleGuide' => 'http://example.org/styleguide' }) end it 'adds style guide url' do @@ -158,11 +156,7 @@ describe '#urls' do let(:urls) { annotator.urls } let(:config) do - RuboCop::Config.new( - 'AllCops' => { - 'StyleGuideBaseURL' => 'http://example.org/styleguide' - } - ) + RuboCop::Config.new('AllCops' => { 'StyleGuideBaseURL' => 'http://example.org/styleguide' }) end it 'returns an empty array without StyleGuide URL' do diff --git a/spec/rubocop/cop/naming/file_name_spec.rb b/spec/rubocop/cop/naming/file_name_spec.rb index 79c3a4d8ce44..d1f7556d8c42 100644 --- a/spec/rubocop/cop/naming/file_name_spec.rb +++ b/spec/rubocop/cop/naming/file_name_spec.rb @@ -278,10 +278,7 @@ module A context 'when CheckDefinitionPathHierarchy is false' do let(:cop_config) do - super().merge( - 'ExpectMatchingDefinition' => true, - 'CheckDefinitionPathHierarchy' => false - ) + super().merge('ExpectMatchingDefinition' => true, 'CheckDefinitionPathHierarchy' => false) end context 'on a file with a matching class' do @@ -417,10 +414,7 @@ module Foo context 'with acronym namespace' do let(:cop_config) do - super().merge( - 'ExpectMatchingDefinition' => true, - 'AllowedAcronyms' => ['CLI'] - ) + super().merge('ExpectMatchingDefinition' => true, 'AllowedAcronyms' => ['CLI']) end it 'does not register an offense' do @@ -437,10 +431,7 @@ class AdminUser context 'with acronym class name' do let(:cop_config) do - super().merge( - 'ExpectMatchingDefinition' => true, - 'AllowedAcronyms' => ['CLI'] - ) + super().merge('ExpectMatchingDefinition' => true, 'AllowedAcronyms' => ['CLI']) end it 'does not register an offense' do @@ -455,10 +446,7 @@ class CLI context 'with include acronym name' do let(:cop_config) do - super().merge( - 'ExpectMatchingDefinition' => true, - 'AllowedAcronyms' => ['HTTP'] - ) + super().merge('ExpectMatchingDefinition' => true, 'AllowedAcronyms' => ['HTTP']) end it 'does not register an offense' do diff --git a/spec/rubocop/cop/offense_spec.rb b/spec/rubocop/cop/offense_spec.rb index 143dc21ee623..bae0b690641d 100644 --- a/spec/rubocop/cop/offense_spec.rb +++ b/spec/rubocop/cop/offense_spec.rb @@ -60,9 +60,7 @@ describe '#severity_level' do subject(:severity_level) do - described_class.new(severity, location, 'message', 'CopName') - .severity - .level + described_class.new(severity, location, 'message', 'CopName').severity.level end context 'when severity is :info' do @@ -137,8 +135,7 @@ def location(line, column, source) context 'offenses that span multiple lines' do subject(:offense) do - described_class - .new(:convention, location, 'message', 'CopName', :corrected) + described_class.new(:convention, location, 'message', 'CopName', :corrected) end let(:location) do @@ -160,8 +157,7 @@ def foo context 'offenses that span part of a line' do subject(:offense) do - described_class - .new(:convention, location, 'message', 'CopName', :corrected) + described_class.new(:convention, location, 'message', 'CopName', :corrected) end let(:location) do diff --git a/spec/rubocop/cop/style/empty_literal_spec.rb b/spec/rubocop/cop/style/empty_literal_spec.rb index a9a53d408cf2..693331540cb3 100644 --- a/spec/rubocop/cop/style/empty_literal_spec.rb +++ b/spec/rubocop/cop/style/empty_literal_spec.rb @@ -252,9 +252,7 @@ def foo context 'when double-quoted string literals are preferred' do let(:other_cops) do - super().merge('Style/StringLiterals' => { - 'EnforcedStyle' => 'double_quotes' - }) + super().merge('Style/StringLiterals' => { 'EnforcedStyle' => 'double_quotes' }) end it 'registers an offense for String.new' do diff --git a/spec/rubocop/cop/style/nested_parenthesized_calls_spec.rb b/spec/rubocop/cop/style/nested_parenthesized_calls_spec.rb index 7feb3019b1a9..e55faa36e03d 100644 --- a/spec/rubocop/cop/style/nested_parenthesized_calls_spec.rb +++ b/spec/rubocop/cop/style/nested_parenthesized_calls_spec.rb @@ -2,9 +2,7 @@ RSpec.describe RuboCop::Cop::Style::NestedParenthesizedCalls, :config do let(:config) do - RuboCop::Config.new( - 'Style/NestedParenthesizedCalls' => { 'AllowedMethods' => ['be'] } - ) + RuboCop::Config.new('Style/NestedParenthesizedCalls' => { 'AllowedMethods' => ['be'] }) end context 'on a non-parenthesized method call' do diff --git a/spec/rubocop/cop/style/redundant_fetch_block_spec.rb b/spec/rubocop/cop/style/redundant_fetch_block_spec.rb index d0589b2a18d1..490a2daefb49 100644 --- a/spec/rubocop/cop/style/redundant_fetch_block_spec.rb +++ b/spec/rubocop/cop/style/redundant_fetch_block_spec.rb @@ -3,11 +3,7 @@ RSpec.describe RuboCop::Cop::Style::RedundantFetchBlock, :config do context 'with SafeForConstants: true' do let(:config) do - RuboCop::Config.new( - 'Style/RedundantFetchBlock' => { - 'SafeForConstants' => true - } - ) + RuboCop::Config.new('Style/RedundantFetchBlock' => { 'SafeForConstants' => true }) end it 'registers an offense and corrects when using `#fetch` with Integer in the block' do @@ -129,11 +125,7 @@ context 'with SafeForConstants: false' do let(:config) do - RuboCop::Config.new( - 'Style/RedundantFetchBlock' => { - 'SafeForConstants' => false - } - ) + RuboCop::Config.new('Style/RedundantFetchBlock' => { 'SafeForConstants' => false }) end it 'does not register an offense when using `#fetch` with constant in the block' do diff --git a/spec/rubocop/cop/style/rescue_modifier_spec.rb b/spec/rubocop/cop/style/rescue_modifier_spec.rb index 7a44461de057..62cf74c7b7ef 100644 --- a/spec/rubocop/cop/style/rescue_modifier_spec.rb +++ b/spec/rubocop/cop/style/rescue_modifier_spec.rb @@ -210,9 +210,7 @@ def self.some_method describe 'excluded file', :config do let(:config) do - RuboCop::Config.new('Style/RescueModifier' => - { 'Enabled' => true, - 'Exclude' => ['**/**'] }) + RuboCop::Config.new('Style/RescueModifier' => { 'Enabled' => true, 'Exclude' => ['**/**'] }) end it 'processes excluded files with issue' do diff --git a/spec/rubocop/cop/team_spec.rb b/spec/rubocop/cop/team_spec.rb index 7cc75d9a86f2..c8f7389e90bc 100644 --- a/spec/rubocop/cop/team_spec.rb +++ b/spec/rubocop/cop/team_spec.rb @@ -246,9 +246,7 @@ def self.support_multiple_source? context 'when only some cop classes are passed to .new' do let(:cop_classes) do - RuboCop::Cop::Registry.new( - [RuboCop::Cop::Lint::Void, RuboCop::Cop::Layout::LineLength] - ) + RuboCop::Cop::Registry.new([RuboCop::Cop::Lint::Void, RuboCop::Cop::Layout::LineLength]) end it 'returns only instances of the classes' do diff --git a/spec/rubocop/formatter/clang_style_formatter_spec.rb b/spec/rubocop/formatter/clang_style_formatter_spec.rb index 74db9fcf92f9..5ca6cb76570b 100644 --- a/spec/rubocop/formatter/clang_style_formatter_spec.rb +++ b/spec/rubocop/formatter/clang_style_formatter_spec.rb @@ -12,8 +12,7 @@ let(:file) { '/path/to/file' } let(:offense) do - RuboCop::Cop::Offense.new(:convention, location, - 'This is a message.', 'CopName', status) + RuboCop::Cop::Offense.new(:convention, location, 'This is a message.', 'CopName', status) end let(:source) { ('aa'..'az').to_a.join($RS) } diff --git a/spec/rubocop/formatter/emacs_style_formatter_spec.rb b/spec/rubocop/formatter/emacs_style_formatter_spec.rb index 729c96186dc1..cd79bc610da8 100644 --- a/spec/rubocop/formatter/emacs_style_formatter_spec.rb +++ b/spec/rubocop/formatter/emacs_style_formatter_spec.rb @@ -33,8 +33,7 @@ let(:file) { '/path/to/file' } let(:offense) do - RuboCop::Cop::Offense.new(:convention, location, - 'This is a message.', 'CopName', status) + RuboCop::Cop::Offense.new(:convention, location, 'This is a message.', 'CopName', status) end let(:location) do @@ -55,8 +54,7 @@ let(:file) { '/path/to/file' } let(:offense) do - RuboCop::Cop::Offense.new(:convention, location, - 'This is a message.', 'CopName', status) + RuboCop::Cop::Offense.new(:convention, location, 'This is a message.', 'CopName', status) end let(:location) do diff --git a/spec/rubocop/formatter/json_formatter_spec.rb b/spec/rubocop/formatter/json_formatter_spec.rb index 928ef8ba8584..938c1e3c9475 100644 --- a/spec/rubocop/formatter/json_formatter_spec.rb +++ b/spec/rubocop/formatter/json_formatter_spec.rb @@ -11,8 +11,7 @@ Parser::Source::Range.new(source_buffer, 2, 10) end let(:offense) do - RuboCop::Cop::Offense.new(:convention, location, - 'This is message', 'CopName', :corrected) + RuboCop::Cop::Offense.new(:convention, location, 'This is message', 'CopName', :corrected) end describe '#started' do diff --git a/spec/rubocop/options_spec.rb b/spec/rubocop/options_spec.rb index 0771031e5d51..b2c1dc51748e 100644 --- a/spec/rubocop/options_spec.rb +++ b/spec/rubocop/options_spec.rb @@ -288,22 +288,19 @@ def abs(path) describe '--fail-level' do it 'accepts full severity names' do %w[info refactor convention warning error fatal].each do |severity| - expect { options.parse(['--fail-level', severity]) } - .not_to raise_error + expect { options.parse(['--fail-level', severity]) }.not_to raise_error end end it 'accepts severity initial letters' do %w[I R C W E F].each do |severity| - expect { options.parse(['--fail-level', severity]) } - .not_to raise_error + expect { options.parse(['--fail-level', severity]) }.not_to raise_error end end it 'accepts the "fake" severities A/autocorrect' do %w[autocorrect A].each do |severity| - expect { options.parse(['--fail-level', severity]) } - .not_to raise_error + expect { options.parse(['--fail-level', severity]) }.not_to raise_error end end end diff --git a/spec/rubocop/result_cache_spec.rb b/spec/rubocop/result_cache_spec.rb index fe0d53aefcf5..5d71a97b40ac 100644 --- a/spec/rubocop/result_cache_spec.rb +++ b/spec/rubocop/result_cache_spec.rb @@ -7,11 +7,7 @@ let(:registry) { RuboCop::Cop::Registry.global } let(:team) do - RuboCop::Cop::Team.mobilize( - registry, - RuboCop::ConfigLoader.default_configuration, - options - ) + RuboCop::Cop::Team.mobilize(registry, RuboCop::ConfigLoader.default_configuration, options) end let(:file) { 'example.rb' } @@ -283,8 +279,7 @@ def abs(path) "unused var \xF0", (+'unused var あ').force_encoding(::Encoding::ASCII_8BIT) ].map do |message| - RuboCop::Cop::Offense.new(:warning, location, message, - 'Lint/UselessAssignment') + RuboCop::Cop::Offense.new(:warning, location, message, 'Lint/UselessAssignment') end end diff --git a/tasks/cut_release.rake b/tasks/cut_release.rake index fb1d30d81496..9b4fe753bc71 100644 --- a/tasks/cut_release.rake +++ b/tasks/cut_release.rake @@ -31,18 +31,14 @@ namespace :cut_release do # Replace `<>` (and variations) with version being cut. def update_cop_versions(_old_version, new_version) update_file('config/default.yml') do |default| - default.gsub(/['"]?<<\s*next\s*>>['"]?/i, - "'#{version_sans_patch(new_version)}'") + default.gsub(/['"]?<<\s*next\s*>>['"]?/i, "'#{version_sans_patch(new_version)}'") end RuboCop::ConfigLoader.default_configuration = nil # invalidate loaded conf end def update_docs(old_version, new_version) update_file('docs/antora.yml') do |antora_metadata| - antora_metadata.sub( - 'version: ~', - "version: '#{version_sans_patch(new_version)}'" - ) + antora_metadata.sub('version: ~', "version: '#{version_sans_patch(new_version)}'") end update_file('docs/modules/ROOT/pages/installation.adoc') do |installation| @@ -55,19 +51,13 @@ namespace :cut_release do def update_issue_template(old_version, new_version) update_file('.github/ISSUE_TEMPLATE/bug_report.md') do |issue_template| - issue_template.sub( - "#{old_version} (using Parser ", - "#{new_version} (using Parser " - ) + issue_template.sub("#{old_version} (using Parser ", "#{new_version} (using Parser ") end end def update_contributing_doc(old_version, new_version) update_file('CONTRIBUTING.md') do |contributing_doc| - contributing_doc.sub( - "#{old_version} (using Parser ", - "#{new_version} (using Parser " - ) + contributing_doc.sub("#{old_version} (using Parser ", "#{new_version} (using Parser ") end end