Use separate RuboCop configs for formulae and core code.
This commit is contained in:
parent
d624627885
commit
70fc825787
@ -1,12 +0,0 @@
|
||||
inherit_from:
|
||||
- .rubocop_rules.yml
|
||||
- .rubocop_todo.yml
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.0
|
||||
Include:
|
||||
- '**/.simplecov'
|
||||
Exclude:
|
||||
- 'Homebrew/cask/**/*'
|
||||
- 'Homebrew/vendor/**/*'
|
||||
- 'Homebrew/test/vendor/**/*'
|
||||
@ -1,3 +1,6 @@
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.0
|
||||
|
||||
Metrics/AbcSize:
|
||||
Enabled: false
|
||||
|
||||
@ -15,10 +18,6 @@ Metrics/MethodLength:
|
||||
|
||||
Metrics/ModuleLength:
|
||||
CountComments: false
|
||||
Exclude:
|
||||
- 'Homebrew/cask/lib/hbc/locations.rb'
|
||||
- 'Homebrew/cask/lib/hbc/macos.rb'
|
||||
- 'Homebrew/cask/lib/hbc/utils.rb'
|
||||
|
||||
Metrics/PerceivedComplexity:
|
||||
Enabled: false
|
||||
@ -36,11 +35,6 @@ Lint/AssignmentInCondition:
|
||||
Lint/EndAlignment:
|
||||
AlignWith: variable
|
||||
|
||||
# `formula do` uses nested method definitions
|
||||
Lint/NestedMethodDefinition:
|
||||
Exclude:
|
||||
- 'Homebrew/test/**/*'
|
||||
|
||||
Lint/ParenthesesAsGroupedExpression:
|
||||
Enabled: false
|
||||
|
||||
@ -54,85 +48,6 @@ Style/AlignHash:
|
||||
Style/AlignParameters:
|
||||
Enabled: false
|
||||
|
||||
Style/BarePercentLiterals:
|
||||
Exclude:
|
||||
- 'Taps/**/*'
|
||||
EnforcedStyle: percent_q
|
||||
|
||||
Style/BlockDelimiters:
|
||||
EnforcedStyle: semantic
|
||||
Exclude:
|
||||
- 'Taps/**/*'
|
||||
FunctionalMethods:
|
||||
- expect
|
||||
- find
|
||||
- let
|
||||
- let!
|
||||
- subject
|
||||
- watch
|
||||
- inject
|
||||
- map
|
||||
- map!
|
||||
- collect
|
||||
- collect!
|
||||
- reject
|
||||
- reject!
|
||||
- delete_if
|
||||
- with_object
|
||||
- popen_read
|
||||
ProceduralMethods:
|
||||
- after
|
||||
- at_exit
|
||||
- before
|
||||
- benchmark
|
||||
- bm
|
||||
- bmbm
|
||||
- capture_io
|
||||
- capture_output
|
||||
- capture_subprocess_io
|
||||
- chdir
|
||||
- context
|
||||
- create
|
||||
- define_method
|
||||
- define_singleton_method
|
||||
- fork
|
||||
- measure
|
||||
- new
|
||||
- open
|
||||
- realtime
|
||||
- shutup
|
||||
- tap
|
||||
- each
|
||||
- each_pair
|
||||
- each_with_index
|
||||
- reverse_each
|
||||
- ignore_interrupts
|
||||
IgnoredMethods:
|
||||
- each_with_object
|
||||
- it
|
||||
- its
|
||||
- lambda
|
||||
- proc
|
||||
- formula
|
||||
- mock
|
||||
- devel
|
||||
- stable
|
||||
- head
|
||||
- assert_raises
|
||||
- assert_nothing_raised
|
||||
- resource
|
||||
- with_build_environment
|
||||
- ensure_writable
|
||||
- satisfy
|
||||
- fetch
|
||||
- brew
|
||||
- expand
|
||||
- env
|
||||
- recursive_dependencies
|
||||
- trap
|
||||
- link_dir
|
||||
- with_system_path
|
||||
|
||||
Style/CaseIndentation:
|
||||
IndentWhenRelativeTo: end
|
||||
|
||||
@ -158,29 +73,9 @@ Style/EmptyLineBetweenDefs:
|
||||
Style/FileName:
|
||||
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
|
||||
|
||||
# counterproductive in formulas, notably within the install method
|
||||
Style/GuardClause:
|
||||
Exclude:
|
||||
- 'Taps/**/*'
|
||||
|
||||
# depends_on foo: :bar looks rubbish
|
||||
Style/HashSyntax:
|
||||
EnforcedStyle: ruby19_no_mixed_keys
|
||||
Exclude:
|
||||
- 'Taps/**/*'
|
||||
|
||||
Style/IfUnlessModifier:
|
||||
Exclude:
|
||||
- 'Taps/**/*'
|
||||
|
||||
Style/IndentArray:
|
||||
EnforcedStyle: special_inside_parentheses
|
||||
|
||||
# we won't change backward compatible method names
|
||||
Style/MethodName:
|
||||
Exclude:
|
||||
- 'Homebrew/compat/**/*'
|
||||
|
||||
# only for numbers >= 1_000_000
|
||||
Style/NumericLiterals:
|
||||
MinDigits: 7
|
||||
@ -206,12 +101,6 @@ Style/PercentLiteralDelimiters:
|
||||
Style/PerlBackrefs:
|
||||
Enabled: false
|
||||
|
||||
# we won't change backward compatible predicate names
|
||||
Style/PredicateName:
|
||||
Exclude:
|
||||
- 'Homebrew/compat/**/*'
|
||||
NameWhitelist: is_32_bit?, is_64_bit?
|
||||
|
||||
Style/RaiseArgs:
|
||||
EnforcedStyle: exploded
|
||||
|
||||
112
Library/.rubocop_core.yml
Normal file
112
Library/.rubocop_core.yml
Normal file
@ -0,0 +1,112 @@
|
||||
inherit_from:
|
||||
- .rubocop_common.yml
|
||||
- .rubocop_todo.yml
|
||||
|
||||
AllCops:
|
||||
Include:
|
||||
- '**/.simplecov'
|
||||
Exclude:
|
||||
- 'Homebrew/cask/**/*'
|
||||
- 'Homebrew/**/vendor/**/*'
|
||||
|
||||
# `formula do` uses nested method definitions
|
||||
Lint/NestedMethodDefinition:
|
||||
Exclude:
|
||||
- 'Homebrew/test/**/*'
|
||||
|
||||
Metrics/ModuleLength:
|
||||
CountComments: false
|
||||
Exclude:
|
||||
- 'Homebrew/cask/lib/hbc/locations.rb'
|
||||
- 'Homebrew/cask/lib/hbc/macos.rb'
|
||||
- 'Homebrew/cask/lib/hbc/utils.rb'
|
||||
|
||||
Style/BarePercentLiterals:
|
||||
EnforcedStyle: percent_q
|
||||
|
||||
Style/BlockDelimiters:
|
||||
EnforcedStyle: semantic
|
||||
FunctionalMethods:
|
||||
- expect
|
||||
- find
|
||||
- let
|
||||
- let!
|
||||
- subject
|
||||
- watch
|
||||
- inject
|
||||
- map
|
||||
- map!
|
||||
- collect
|
||||
- collect!
|
||||
- reject
|
||||
- reject!
|
||||
- delete_if
|
||||
- with_object
|
||||
- popen_read
|
||||
ProceduralMethods:
|
||||
- after
|
||||
- at_exit
|
||||
- before
|
||||
- benchmark
|
||||
- bm
|
||||
- bmbm
|
||||
- capture_io
|
||||
- capture_output
|
||||
- capture_subprocess_io
|
||||
- chdir
|
||||
- context
|
||||
- create
|
||||
- define_method
|
||||
- define_singleton_method
|
||||
- fork
|
||||
- measure
|
||||
- new
|
||||
- open
|
||||
- realtime
|
||||
- shutup
|
||||
- tap
|
||||
- each
|
||||
- each_pair
|
||||
- each_with_index
|
||||
- reverse_each
|
||||
- ignore_interrupts
|
||||
IgnoredMethods:
|
||||
- each_with_object
|
||||
- it
|
||||
- its
|
||||
- lambda
|
||||
- proc
|
||||
- formula
|
||||
- mock
|
||||
- devel
|
||||
- stable
|
||||
- head
|
||||
- assert_raises
|
||||
- assert_nothing_raised
|
||||
- resource
|
||||
- with_build_environment
|
||||
- ensure_writable
|
||||
- satisfy
|
||||
- fetch
|
||||
- brew
|
||||
- expand
|
||||
- env
|
||||
- recursive_dependencies
|
||||
- trap
|
||||
- link_dir
|
||||
- with_system_path
|
||||
|
||||
Style/HashSyntax:
|
||||
EnforcedStyle: ruby19_no_mixed_keys
|
||||
|
||||
# we won't change backward compatible method names
|
||||
Style/MethodName:
|
||||
Exclude:
|
||||
- 'Homebrew/compat/**/*'
|
||||
|
||||
# we won't change backward compatible predicate names
|
||||
Style/PredicateName:
|
||||
Exclude:
|
||||
- 'Homebrew/compat/**/*'
|
||||
NameWhitelist: is_32_bit?, is_64_bit?
|
||||
|
||||
12
Library/.rubocop_formula.yml
Normal file
12
Library/.rubocop_formula.yml
Normal file
@ -0,0 +1,12 @@
|
||||
inherit_from:
|
||||
- .rubocop_common.yml
|
||||
|
||||
# counterproductive in formulas, notably within the install method
|
||||
Style/GuardClause:
|
||||
Enabled: false
|
||||
Style/IfUnlessModifier:
|
||||
Enabled: false
|
||||
|
||||
# depends_on foo: :bar looks rubbish
|
||||
Style/HashSyntax:
|
||||
Enabled: false
|
||||
@ -1,6 +1,6 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --exclude-limit 100`
|
||||
# on 2016-09-25 02:39:38 +0200 using RuboCop version 0.43.0.
|
||||
# on 2016-09-27 18:48:13 +0200 using RuboCop version 0.43.0.
|
||||
# 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
|
||||
@ -37,7 +37,6 @@ Lint/Loop:
|
||||
# Offense count: 1
|
||||
Lint/NestedMethodDefinition:
|
||||
Exclude:
|
||||
- 'Homebrew/test/**/*'
|
||||
- 'Homebrew/dev-cmd/bottle.rb'
|
||||
|
||||
# Offense count: 28
|
||||
@ -72,28 +71,26 @@ Metrics/BlockNesting:
|
||||
# Offense count: 19
|
||||
# Configuration parameters: CountComments.
|
||||
Metrics/ModuleLength:
|
||||
Max: 366
|
||||
Max: 367
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: CountKeywordArgs.
|
||||
Metrics/ParameterLists:
|
||||
Max: 6
|
||||
|
||||
# Offense count: 9
|
||||
# Offense count: 8
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: percent_q, bare_percent
|
||||
Style/BarePercentLiterals:
|
||||
Exclude:
|
||||
- 'Taps/**/*'
|
||||
- 'Homebrew/dev-cmd/audit.rb'
|
||||
- 'Homebrew/test/test_diagnostic.rb'
|
||||
- 'Homebrew/test/test_exceptions.rb'
|
||||
- 'Homebrew/test/test_integration_cmds.rb'
|
||||
- 'Homebrew/test/test_patch.rb'
|
||||
- 'Homebrew/test/test_string.rb'
|
||||
|
||||
# Offense count: 136
|
||||
# Offense count: 134
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
|
||||
# SupportedStyles: line_count_based, semantic, braces_for_chaining
|
||||
@ -102,7 +99,6 @@ Style/BarePercentLiterals:
|
||||
# IgnoredMethods: lambda, proc, it
|
||||
Style/BlockDelimiters:
|
||||
Exclude:
|
||||
- 'Taps/**/*'
|
||||
- 'Homebrew/caveats.rb'
|
||||
- 'Homebrew/cleaner.rb'
|
||||
- 'Homebrew/cleanup.rb'
|
||||
@ -157,13 +153,11 @@ Style/BlockDelimiters:
|
||||
- 'Homebrew/test/lib/config.rb'
|
||||
- 'Homebrew/test/test_ARGV.rb'
|
||||
- 'Homebrew/test/test_cleanup.rb'
|
||||
- 'Homebrew/test/test_cmd_audit.rb'
|
||||
- 'Homebrew/test/test_dependency_collector.rb'
|
||||
- 'Homebrew/test/test_formula_installer.rb'
|
||||
- 'Homebrew/test/test_formula_installer_bottle.rb'
|
||||
- 'Homebrew/test/test_formulary.rb'
|
||||
- 'Homebrew/test/test_gpg.rb'
|
||||
- 'Homebrew/test/test_integration_cmds.rb'
|
||||
- 'Homebrew/test/test_migrator.rb'
|
||||
- 'Homebrew/test/test_pathname.rb'
|
||||
- 'Homebrew/test/test_tap.rb'
|
||||
@ -188,20 +182,12 @@ Style/GlobalVars:
|
||||
- 'Homebrew/utils.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: SupportedStyles, IndentationWidth.
|
||||
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
||||
Style/IndentArray:
|
||||
EnforcedStyle: special_inside_parentheses
|
||||
|
||||
# Offense count: 5
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: module_function, extend_self
|
||||
Style/ModuleFunction:
|
||||
Exclude:
|
||||
- 'Homebrew/global.rb'
|
||||
- 'Homebrew/os/mac/xcode.rb'
|
||||
- 'Homebrew/os/mac/xquartz.rb'
|
||||
|
||||
# Offense count: 8
|
||||
Style/MultilineBlockChain:
|
||||
@ -222,7 +208,6 @@ Style/MutableConstant:
|
||||
- 'Homebrew/tab.rb'
|
||||
- 'Homebrew/tap.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# Offense count: 8
|
||||
Style/OpMethod:
|
||||
Exclude:
|
||||
|
||||
@ -19,7 +19,7 @@ require "utils/json"
|
||||
module Homebrew
|
||||
def style
|
||||
target = if ARGV.named.empty?
|
||||
[HOMEBREW_LIBRARY_PATH]
|
||||
nil
|
||||
elsif ARGV.named.any? { |file| File.exist? file }
|
||||
ARGV.named
|
||||
elsif ARGV.named.any? { |tap| tap.count("/") == 1 }
|
||||
@ -49,10 +49,16 @@ module Homebrew
|
||||
|
||||
args = %W[
|
||||
--force-exclusion
|
||||
--config #{HOMEBREW_LIBRARY}/.rubocop.yml
|
||||
]
|
||||
args << "--auto-correct" if fix
|
||||
args += files
|
||||
|
||||
if files.nil?
|
||||
args << "--config" << HOMEBREW_LIBRARY/".rubocop_core.yml"
|
||||
args += [HOMEBREW_LIBRARY_PATH]
|
||||
else
|
||||
args << "--config" << HOMEBREW_LIBRARY/".rubocop_formula.yml"
|
||||
args += files
|
||||
end
|
||||
|
||||
HOMEBREW_LIBRARY.cd do
|
||||
case output_type
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user