From bca922fd5be6ed2e03b5ee2c11522106c5507c50 Mon Sep 17 00:00:00 2001 From: Jan Viljanen <527069+javian@users.noreply.github.com> Date: Thu, 4 Oct 2018 18:09:23 +0200 Subject: [PATCH 1/3] rubocop: only use config if style is testing specified file(s) --- Library/Homebrew/style.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 79dd43fd55..60198886da 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -60,13 +60,10 @@ module Homebrew has_non_formula = Array(files).any? do |file| File.expand_path(file).start_with? HOMEBREW_LIBRARY_PATH end - config_file = if files.nil? || has_non_formula - HOMEBREW_LIBRARY_PATH/".rubocop.yml" - else - HOMEBREW_LIBRARY/".rubocop_audit.yml" - end - args << "--config" << config_file + unless files.nil? || has_non_formula + args << "--config" << HOMEBREW_LIBRARY/".rubocop_audit.yml" + end if files.nil? args << HOMEBREW_LIBRARY_PATH From aa6912425e1fa1db5ede07a9453ef8bca153132f Mon Sep 17 00:00:00 2001 From: Jan Viljanen <527069+javian@users.noreply.github.com> Date: Thu, 4 Oct 2018 18:22:23 +0200 Subject: [PATCH 2/3] rubocop: move rspec include to root config file To avoid confusion and bugs in rubocop robucop-spec should be required from the root config. --- Library/.rubocop.yml | 7 +++- Library/Homebrew/test/.rubocop.yml | 1 - Library/Homebrew/test/.rubocop_todo.yml | 43 ++++++++++++++++++++----- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 67b37c111c..97642ba7da 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -4,8 +4,13 @@ AllCops: - '**/Casks/**/*' - '**/vendor/**/*' DisplayCopNames: false + RSpec: + Patterns: + - Homebrew/test/* -require: ./Homebrew/rubocops.rb +require: + - ./Homebrew/rubocops.rb + - rubocop-rspec # enable all formulae audits FormulaAudit: diff --git a/Library/Homebrew/test/.rubocop.yml b/Library/Homebrew/test/.rubocop.yml index 5eeb756a13..ab889eb419 100644 --- a/Library/Homebrew/test/.rubocop.yml +++ b/Library/Homebrew/test/.rubocop.yml @@ -2,4 +2,3 @@ inherit_from: - ../.rubocop.yml - .rubocop_todo.yml -require: rubocop-rspec diff --git a/Library/Homebrew/test/.rubocop_todo.yml b/Library/Homebrew/test/.rubocop_todo.yml index bd00412da3..d3a7d38277 100644 --- a/Library/Homebrew/test/.rubocop_todo.yml +++ b/Library/Homebrew/test/.rubocop_todo.yml @@ -1,14 +1,15 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2018-09-30 14:57:59 +0200 using RuboCop version 0.59.2. +# on 2018-10-08 06:47:14 +0200 using RuboCop version 0.59.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 27 +# Offense count: 28 RSpec/AnyInstance: Exclude: + - 'cask/artifact/uninstall_zap_shared_examples.rb' - 'cask/cmd/create_spec.rb' - 'cask/cmd/edit_spec.rb' - 'cask/cmd/outdated_spec.rb' @@ -21,7 +22,7 @@ RSpec/AnyInstance: - 'utils/analytics_spec.rb' - 'utils/git_spec.rb' -# Offense count: 139 +# Offense count: 146 # Configuration parameters: Prefixes. # Prefixes: when, with, without RSpec/ContextWording: @@ -31,7 +32,7 @@ RSpec/ContextWording: RSpec/DescribeClass: Enabled: false -# Offense count: 573 +# Offense count: 581 # Configuration parameters: Max. RSpec/ExampleLength: Enabled: false @@ -58,6 +59,16 @@ RSpec/ExpectInHook: RSpec/FilePath: Enabled: false +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, each, example +RSpec/HookArgument: + Exclude: + - 'cask/artifact/uninstall_zap_shared_examples.rb' + - 'spec_helper.rb' + - 'support/helper/cask/fake_system_command.rb' + # Offense count: 6 # Configuration parameters: AssignmentOnly. RSpec/InstanceVariable: @@ -67,7 +78,18 @@ RSpec/InstanceVariable: - 'utils/git_spec.rb' - 'version_spec.rb' -# Offense count: 116 +# Offense count: 1 +RSpec/IteratedExpectation: + Exclude: + - 'cask/artifact/uninstall_zap_shared_examples.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +RSpec/LeadingSubject: + Exclude: + - 'cask/artifact/uninstall_zap_shared_examples.rb' + +# Offense count: 122 # Configuration parameters: EnforcedStyle. # SupportedStyles: have_received, receive RSpec/MessageSpies: @@ -82,12 +104,12 @@ RSpec/MissingExampleGroupArgument: RSpec/MultipleDescribes: Enabled: false -# Offense count: 544 +# Offense count: 548 # Configuration parameters: AggregateFailuresByDefault. RSpec/MultipleExpectations: Max: 26 -# Offense count: 936 +# Offense count: 946 RSpec/NamedSubject: Enabled: false @@ -110,6 +132,11 @@ RSpec/RepeatedExample: - 'compiler_selector_spec.rb' - 'utils/shell_spec.rb' +# Offense count: 2 +RSpec/ScatteredLet: + Exclude: + - 'cask/artifact/uninstall_zap_shared_examples.rb' + # Offense count: 31 RSpec/SubjectStub: Exclude: @@ -121,7 +148,7 @@ RSpec/SubjectStub: - 'language/python_spec.rb' - 'os/mac/java_requirement_spec.rb' -# Offense count: 64 +# Offense count: 65 # Configuration parameters: IgnoreSymbolicNames. RSpec/VerifiedDoubles: Enabled: false From ce530fd0f54a4eccf45daffb05bbc08e30e72d73 Mon Sep 17 00:00:00 2001 From: Jan Viljanen <527069+javian@users.noreply.github.com> Date: Tue, 9 Oct 2018 22:10:25 +0200 Subject: [PATCH 3/3] move rspec pattern --- Library/.rubocop.yml | 3 --- Library/Homebrew/test/.rubocop.yml | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 97642ba7da..1185b589cc 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -4,9 +4,6 @@ AllCops: - '**/Casks/**/*' - '**/vendor/**/*' DisplayCopNames: false - RSpec: - Patterns: - - Homebrew/test/* require: - ./Homebrew/rubocops.rb diff --git a/Library/Homebrew/test/.rubocop.yml b/Library/Homebrew/test/.rubocop.yml index ab889eb419..245653243b 100644 --- a/Library/Homebrew/test/.rubocop.yml +++ b/Library/Homebrew/test/.rubocop.yml @@ -2,3 +2,7 @@ inherit_from: - ../.rubocop.yml - .rubocop_todo.yml +AllCops: + RSpec: + Patterns: + - ./*