From 70fc82578795a3c99fb149615e2efbf4596ea4a4 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 27 Sep 2016 18:48:06 +0200 Subject: Use separate RuboCop configs for formulae and core code. --- Library/.rubocop.yml | 12 -- Library/.rubocop_common.yml | 147 ++++++++++++++++++++++++ Library/.rubocop_core.yml | 112 ++++++++++++++++++ Library/.rubocop_formula.yml | 12 ++ Library/.rubocop_rules.yml | 258 ------------------------------------------ Library/.rubocop_todo.yml | 23 +--- Library/Homebrew/cmd/style.rb | 12 +- 7 files changed, 284 insertions(+), 292 deletions(-) delete mode 100644 Library/.rubocop.yml create mode 100644 Library/.rubocop_common.yml create mode 100644 Library/.rubocop_core.yml create mode 100644 Library/.rubocop_formula.yml delete mode 100644 Library/.rubocop_rules.yml (limited to 'Library') diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml deleted file mode 100644 index 99de0d8a2..000000000 --- a/Library/.rubocop.yml +++ /dev/null @@ -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/**/*' diff --git a/Library/.rubocop_common.yml b/Library/.rubocop_common.yml new file mode 100644 index 000000000..3563acf1f --- /dev/null +++ b/Library/.rubocop_common.yml @@ -0,0 +1,147 @@ +AllCops: + TargetRubyVersion: 2.0 + +Metrics/AbcSize: + Enabled: false + +Metrics/ClassLength: + Enabled: false + +Metrics/CyclomaticComplexity: + Enabled: false + +Metrics/LineLength: + Enabled: false + +Metrics/MethodLength: + Enabled: false + +Metrics/ModuleLength: + CountComments: false + +Metrics/PerceivedComplexity: + Enabled: false + +# favor parens-less DSL-style arguments +Lint/AmbiguousOperator: + Enabled: false + +Lint/AmbiguousRegexpLiteral: + Enabled: false + +Lint/AssignmentInCondition: + Enabled: false + +Lint/EndAlignment: + AlignWith: variable + +Lint/ParenthesesAsGroupedExpression: + Enabled: false + +Style/Alias: + EnforcedStyle: prefer_alias + +Style/AlignHash: + Enabled: false + +# `system` is a special case and aligns on second argument +Style/AlignParameters: + Enabled: false + +Style/CaseIndentation: + IndentWhenRelativeTo: end + +Style/ClassAndModuleChildren: + EnforcedStyle: nested + +# percent-x is allowed for multiline +Style/CommandLiteral: + EnforcedStyle: mixed + +# our current conditional style is established, clear and +# requiring users to change that now would be confusing. +Style/ConditionalAssignment: + Enabled: false + +Style/Documentation: + Enabled: false + +Style/EmptyLineBetweenDefs: + AllowAdjacentOneLineDefs: true + +# dashes in filenames are typical +Style/FileName: + Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/ + +Style/IndentArray: + EnforcedStyle: special_inside_parentheses + +# only for numbers >= 1_000_000 +Style/NumericLiterals: + MinDigits: 7 + +# zero-prefixed octal literals are just too widely used (and mostly understood) +Style/NumericLiteralPrefix: + EnforcedOctalStyle: zero_only + +# consistency and readability when faced with string interpolation +Style/PercentLiteralDelimiters: + PreferredDelimiters: + '%': '()' + '%i': '()' + '%q': '()' + '%Q': '()' + '%r': '{}' + '%s': '()' + '%w': '[]' + '%W': '[]' + '%x': '()' + +# we prefer Perl-style regex back references +Style/PerlBackrefs: + Enabled: false + +Style/RaiseArgs: + EnforcedStyle: exploded + +# paths abound, easy escape +Style/RegexpLiteral: + EnforcedStyle: slashes + +# conflicts with DSL-style path concatenation with `/` +Style/SpaceAroundOperators: + Enabled: false + +# not a problem for typical shell users +Style/SpecialGlobalVars: + Enabled: false + +# ruby style guide favorite +Style/StringLiterals: + EnforcedStyle: double_quotes + +# consistency with above +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes + +# TODO: enforce when rubocop has shipped this +# https://github.com/bbatsov/rubocop/pull/3513 +Style/TernaryParentheses: + Enabled: false + +# makes diffs nicer +Style/TrailingCommaInLiteral: + EnforcedStyleForMultiline: comma + +Style/UnneededCapitalW: + Enabled: false + +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/3516 +Style/VariableNumber: + Enabled: false + +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/1543 +Style/WordArray: + Enabled: false diff --git a/Library/.rubocop_core.yml b/Library/.rubocop_core.yml new file mode 100644 index 000000000..c4dd9c597 --- /dev/null +++ b/Library/.rubocop_core.yml @@ -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? + diff --git a/Library/.rubocop_formula.yml b/Library/.rubocop_formula.yml new file mode 100644 index 000000000..d763bb460 --- /dev/null +++ b/Library/.rubocop_formula.yml @@ -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 diff --git a/Library/.rubocop_rules.yml b/Library/.rubocop_rules.yml deleted file mode 100644 index 638989291..000000000 --- a/Library/.rubocop_rules.yml +++ /dev/null @@ -1,258 +0,0 @@ -Metrics/AbcSize: - Enabled: false - -Metrics/ClassLength: - Enabled: false - -Metrics/CyclomaticComplexity: - Enabled: false - -Metrics/LineLength: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -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 - -# favor parens-less DSL-style arguments -Lint/AmbiguousOperator: - Enabled: false - -Lint/AmbiguousRegexpLiteral: - Enabled: false - -Lint/AssignmentInCondition: - Enabled: false - -Lint/EndAlignment: - AlignWith: variable - -# `formula do` uses nested method definitions -Lint/NestedMethodDefinition: - Exclude: - - 'Homebrew/test/**/*' - -Lint/ParenthesesAsGroupedExpression: - Enabled: false - -Style/Alias: - EnforcedStyle: prefer_alias - -Style/AlignHash: - Enabled: false - -# `system` is a special case and aligns on second argument -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 - -Style/ClassAndModuleChildren: - EnforcedStyle: nested - -# percent-x is allowed for multiline -Style/CommandLiteral: - EnforcedStyle: mixed - -# our current conditional style is established, clear and -# requiring users to change that now would be confusing. -Style/ConditionalAssignment: - Enabled: false - -Style/Documentation: - Enabled: false - -Style/EmptyLineBetweenDefs: - AllowAdjacentOneLineDefs: true - -# dashes in filenames are typical -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 - -# zero-prefixed octal literals are just too widely used (and mostly understood) -Style/NumericLiteralPrefix: - EnforcedOctalStyle: zero_only - -# consistency and readability when faced with string interpolation -Style/PercentLiteralDelimiters: - PreferredDelimiters: - '%': '()' - '%i': '()' - '%q': '()' - '%Q': '()' - '%r': '{}' - '%s': '()' - '%w': '[]' - '%W': '[]' - '%x': '()' - -# we prefer Perl-style regex back references -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 - -# paths abound, easy escape -Style/RegexpLiteral: - EnforcedStyle: slashes - -# conflicts with DSL-style path concatenation with `/` -Style/SpaceAroundOperators: - Enabled: false - -# not a problem for typical shell users -Style/SpecialGlobalVars: - Enabled: false - -# ruby style guide favorite -Style/StringLiterals: - EnforcedStyle: double_quotes - -# consistency with above -Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes - -# TODO: enforce when rubocop has shipped this -# https://github.com/bbatsov/rubocop/pull/3513 -Style/TernaryParentheses: - Enabled: false - -# makes diffs nicer -Style/TrailingCommaInLiteral: - EnforcedStyleForMultiline: comma - -Style/UnneededCapitalW: - Enabled: false - -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/3516 -Style/VariableNumber: - Enabled: false - -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/1543 -Style/WordArray: - Enabled: false diff --git a/Library/.rubocop_todo.yml b/Library/.rubocop_todo.yml index d3be22eb5..2162a7490 100644 --- a/Library/.rubocop_todo.yml +++ b/Library/.rubocop_todo.yml @@ -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: diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index db61116be..1a4b02277 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -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 -- cgit v1.2.3 From 5b2ae6885b787a2695494a16140c47f6f9175189 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 27 Sep 2016 19:11:56 +0200 Subject: Fix Lint/NestedMethodDefinition` in `dev-cmd/bottle.rb`. --- Library/.rubocop_todo.yml | 5 ----- Library/Homebrew/dev-cmd/bottle.rb | 8 ++++---- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'Library') diff --git a/Library/.rubocop_todo.yml b/Library/.rubocop_todo.yml index 2162a7490..b4ed8bb46 100644 --- a/Library/.rubocop_todo.yml +++ b/Library/.rubocop_todo.yml @@ -34,11 +34,6 @@ Lint/Loop: Exclude: - 'Homebrew/patch.rb' -# Offense count: 1 -Lint/NestedMethodDefinition: - Exclude: - - 'Homebrew/dev-cmd/bottle.rb' - # Offense count: 28 Lint/RescueException: Exclude: diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index b2aa3b2c5..83e40f25d 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -44,9 +44,9 @@ module Homebrew def keg_contain?(string, keg, ignores) @put_string_exists_header, @put_filenames = nil - def print_filename(string, filename) + print_filename = lambda do |str, filename| unless @put_string_exists_header - opoo "String '#{string}' still exists in these files:" + opoo "String '#{str}' still exists in these files:" @put_string_exists_header = true end @@ -68,7 +68,7 @@ module Homebrew result ||= !linked_libraries.empty? if ARGV.verbose? - print_filename(string, file) unless linked_libraries.empty? + print_filename.call(string, file) unless linked_libraries.empty? linked_libraries.each do |lib| puts " #{Tty.gray}-->#{Tty.reset} links to #{lib}" end @@ -91,7 +91,7 @@ module Homebrew end next unless ARGV.verbose? && !text_matches.empty? - print_filename string, file + print_filename.call(string, file) text_matches.first(MAXIMUM_STRING_MATCHES).each do |match, offset| puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}" end -- cgit v1.2.3 From 5800f2f084fa59d073a4793b0fb77630f12b2bab Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 28 Sep 2016 22:34:09 +0200 Subject: Use separate `.rubocop.yml` in `Library/Taps` and `Library/Homebrew`. --- Library/.rubocop.yml | 147 ++++++++++++++++++++++++++ Library/.rubocop_common.yml | 147 -------------------------- Library/.rubocop_core.yml | 112 -------------------- Library/.rubocop_formula.yml | 12 --- Library/.rubocop_todo.yml | 211 ------------------------------------- Library/Homebrew/.rubocop.yml | 112 ++++++++++++++++++++ Library/Homebrew/.rubocop_todo.yml | 211 +++++++++++++++++++++++++++++++++++++ Library/Homebrew/cmd/style.rb | 4 +- 8 files changed, 472 insertions(+), 484 deletions(-) create mode 100644 Library/.rubocop.yml delete mode 100644 Library/.rubocop_common.yml delete mode 100644 Library/.rubocop_core.yml delete mode 100644 Library/.rubocop_formula.yml delete mode 100644 Library/.rubocop_todo.yml create mode 100644 Library/Homebrew/.rubocop.yml create mode 100644 Library/Homebrew/.rubocop_todo.yml (limited to 'Library') diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml new file mode 100644 index 000000000..3563acf1f --- /dev/null +++ b/Library/.rubocop.yml @@ -0,0 +1,147 @@ +AllCops: + TargetRubyVersion: 2.0 + +Metrics/AbcSize: + Enabled: false + +Metrics/ClassLength: + Enabled: false + +Metrics/CyclomaticComplexity: + Enabled: false + +Metrics/LineLength: + Enabled: false + +Metrics/MethodLength: + Enabled: false + +Metrics/ModuleLength: + CountComments: false + +Metrics/PerceivedComplexity: + Enabled: false + +# favor parens-less DSL-style arguments +Lint/AmbiguousOperator: + Enabled: false + +Lint/AmbiguousRegexpLiteral: + Enabled: false + +Lint/AssignmentInCondition: + Enabled: false + +Lint/EndAlignment: + AlignWith: variable + +Lint/ParenthesesAsGroupedExpression: + Enabled: false + +Style/Alias: + EnforcedStyle: prefer_alias + +Style/AlignHash: + Enabled: false + +# `system` is a special case and aligns on second argument +Style/AlignParameters: + Enabled: false + +Style/CaseIndentation: + IndentWhenRelativeTo: end + +Style/ClassAndModuleChildren: + EnforcedStyle: nested + +# percent-x is allowed for multiline +Style/CommandLiteral: + EnforcedStyle: mixed + +# our current conditional style is established, clear and +# requiring users to change that now would be confusing. +Style/ConditionalAssignment: + Enabled: false + +Style/Documentation: + Enabled: false + +Style/EmptyLineBetweenDefs: + AllowAdjacentOneLineDefs: true + +# dashes in filenames are typical +Style/FileName: + Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/ + +Style/IndentArray: + EnforcedStyle: special_inside_parentheses + +# only for numbers >= 1_000_000 +Style/NumericLiterals: + MinDigits: 7 + +# zero-prefixed octal literals are just too widely used (and mostly understood) +Style/NumericLiteralPrefix: + EnforcedOctalStyle: zero_only + +# consistency and readability when faced with string interpolation +Style/PercentLiteralDelimiters: + PreferredDelimiters: + '%': '()' + '%i': '()' + '%q': '()' + '%Q': '()' + '%r': '{}' + '%s': '()' + '%w': '[]' + '%W': '[]' + '%x': '()' + +# we prefer Perl-style regex back references +Style/PerlBackrefs: + Enabled: false + +Style/RaiseArgs: + EnforcedStyle: exploded + +# paths abound, easy escape +Style/RegexpLiteral: + EnforcedStyle: slashes + +# conflicts with DSL-style path concatenation with `/` +Style/SpaceAroundOperators: + Enabled: false + +# not a problem for typical shell users +Style/SpecialGlobalVars: + Enabled: false + +# ruby style guide favorite +Style/StringLiterals: + EnforcedStyle: double_quotes + +# consistency with above +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes + +# TODO: enforce when rubocop has shipped this +# https://github.com/bbatsov/rubocop/pull/3513 +Style/TernaryParentheses: + Enabled: false + +# makes diffs nicer +Style/TrailingCommaInLiteral: + EnforcedStyleForMultiline: comma + +Style/UnneededCapitalW: + Enabled: false + +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/3516 +Style/VariableNumber: + Enabled: false + +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/1543 +Style/WordArray: + Enabled: false diff --git a/Library/.rubocop_common.yml b/Library/.rubocop_common.yml deleted file mode 100644 index 3563acf1f..000000000 --- a/Library/.rubocop_common.yml +++ /dev/null @@ -1,147 +0,0 @@ -AllCops: - TargetRubyVersion: 2.0 - -Metrics/AbcSize: - Enabled: false - -Metrics/ClassLength: - Enabled: false - -Metrics/CyclomaticComplexity: - Enabled: false - -Metrics/LineLength: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -Metrics/ModuleLength: - CountComments: false - -Metrics/PerceivedComplexity: - Enabled: false - -# favor parens-less DSL-style arguments -Lint/AmbiguousOperator: - Enabled: false - -Lint/AmbiguousRegexpLiteral: - Enabled: false - -Lint/AssignmentInCondition: - Enabled: false - -Lint/EndAlignment: - AlignWith: variable - -Lint/ParenthesesAsGroupedExpression: - Enabled: false - -Style/Alias: - EnforcedStyle: prefer_alias - -Style/AlignHash: - Enabled: false - -# `system` is a special case and aligns on second argument -Style/AlignParameters: - Enabled: false - -Style/CaseIndentation: - IndentWhenRelativeTo: end - -Style/ClassAndModuleChildren: - EnforcedStyle: nested - -# percent-x is allowed for multiline -Style/CommandLiteral: - EnforcedStyle: mixed - -# our current conditional style is established, clear and -# requiring users to change that now would be confusing. -Style/ConditionalAssignment: - Enabled: false - -Style/Documentation: - Enabled: false - -Style/EmptyLineBetweenDefs: - AllowAdjacentOneLineDefs: true - -# dashes in filenames are typical -Style/FileName: - Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/ - -Style/IndentArray: - EnforcedStyle: special_inside_parentheses - -# only for numbers >= 1_000_000 -Style/NumericLiterals: - MinDigits: 7 - -# zero-prefixed octal literals are just too widely used (and mostly understood) -Style/NumericLiteralPrefix: - EnforcedOctalStyle: zero_only - -# consistency and readability when faced with string interpolation -Style/PercentLiteralDelimiters: - PreferredDelimiters: - '%': '()' - '%i': '()' - '%q': '()' - '%Q': '()' - '%r': '{}' - '%s': '()' - '%w': '[]' - '%W': '[]' - '%x': '()' - -# we prefer Perl-style regex back references -Style/PerlBackrefs: - Enabled: false - -Style/RaiseArgs: - EnforcedStyle: exploded - -# paths abound, easy escape -Style/RegexpLiteral: - EnforcedStyle: slashes - -# conflicts with DSL-style path concatenation with `/` -Style/SpaceAroundOperators: - Enabled: false - -# not a problem for typical shell users -Style/SpecialGlobalVars: - Enabled: false - -# ruby style guide favorite -Style/StringLiterals: - EnforcedStyle: double_quotes - -# consistency with above -Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes - -# TODO: enforce when rubocop has shipped this -# https://github.com/bbatsov/rubocop/pull/3513 -Style/TernaryParentheses: - Enabled: false - -# makes diffs nicer -Style/TrailingCommaInLiteral: - EnforcedStyleForMultiline: comma - -Style/UnneededCapitalW: - Enabled: false - -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/3516 -Style/VariableNumber: - Enabled: false - -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/1543 -Style/WordArray: - Enabled: false diff --git a/Library/.rubocop_core.yml b/Library/.rubocop_core.yml deleted file mode 100644 index c4dd9c597..000000000 --- a/Library/.rubocop_core.yml +++ /dev/null @@ -1,112 +0,0 @@ -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? - diff --git a/Library/.rubocop_formula.yml b/Library/.rubocop_formula.yml deleted file mode 100644 index d763bb460..000000000 --- a/Library/.rubocop_formula.yml +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/Library/.rubocop_todo.yml b/Library/.rubocop_todo.yml deleted file mode 100644 index b4ed8bb46..000000000 --- a/Library/.rubocop_todo.yml +++ /dev/null @@ -1,211 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config --exclude-limit 100` -# 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 -# versions of RuboCop, may require this file to be generated again. - -# Offense count: 16 -Lint/HandleExceptions: - Exclude: - - 'Homebrew/cmd/install.rb' - - 'Homebrew/cmd/reinstall.rb' - - 'Homebrew/cmd/tap.rb' - - 'Homebrew/cmd/update-report.rb' - - 'Homebrew/cmd/upgrade.rb' - - 'Homebrew/cmd/uses.rb' - - 'Homebrew/descriptions.rb' - - 'Homebrew/diagnostic.rb' - - 'Homebrew/extend/ENV/super.rb' - - 'Homebrew/extend/pathname.rb' - - 'Homebrew/formula.rb' - - 'Homebrew/formula_versions.rb' - - 'Homebrew/test/test_ENV.rb' - -# Offense count: 3 -Lint/IneffectiveAccessModifier: - Exclude: - - 'Homebrew/formula.rb' - - 'Homebrew/version.rb' - -# Offense count: 1 -Lint/Loop: - Exclude: - - 'Homebrew/patch.rb' - -# Offense count: 28 -Lint/RescueException: - Exclude: - - 'Homebrew/brew.rb' - - 'Homebrew/build.rb' - - 'Homebrew/cmd/fetch.rb' - - 'Homebrew/cmd/reinstall.rb' - - 'Homebrew/cmd/update-report.rb' - - 'Homebrew/debrew.rb' - - 'Homebrew/dev-cmd/pull.rb' - - 'Homebrew/dev-cmd/test.rb' - - 'Homebrew/formula.rb' - - 'Homebrew/formula_installer.rb' - - 'Homebrew/migrator.rb' - - 'Homebrew/postinstall.rb' - - 'Homebrew/readall.rb' - - 'Homebrew/test.rb' - - 'Homebrew/test/test_ENV.rb' - - 'Homebrew/utils/fork.rb' - -# Offense count: 1 -Lint/ShadowedException: - Exclude: - - 'Homebrew/utils/fork.rb' - -# Offense count: 14 -Metrics/BlockNesting: - Max: 5 - -# Offense count: 19 -# Configuration parameters: CountComments. -Metrics/ModuleLength: - Max: 367 - -# Offense count: 2 -# Configuration parameters: CountKeywordArgs. -Metrics/ParameterLists: - Max: 6 - -# Offense count: 8 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: percent_q, bare_percent -Style/BarePercentLiterals: - Exclude: - - 'Homebrew/dev-cmd/audit.rb' - - 'Homebrew/test/test_diagnostic.rb' - - 'Homebrew/test/test_exceptions.rb' - - 'Homebrew/test/test_patch.rb' - - 'Homebrew/test/test_string.rb' - -# Offense count: 134 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods. -# SupportedStyles: line_count_based, semantic, braces_for_chaining -# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object -# FunctionalMethods: let, let!, subject, watch -# IgnoredMethods: lambda, proc, it -Style/BlockDelimiters: - Exclude: - - 'Homebrew/caveats.rb' - - 'Homebrew/cleaner.rb' - - 'Homebrew/cleanup.rb' - - 'Homebrew/cmd/deps.rb' - - 'Homebrew/cmd/desc.rb' - - 'Homebrew/cmd/fetch.rb' - - 'Homebrew/cmd/help.rb' - - 'Homebrew/cmd/info.rb' - - 'Homebrew/cmd/linkapps.rb' - - 'Homebrew/cmd/list.rb' - - 'Homebrew/cmd/outdated.rb' - - 'Homebrew/cmd/reinstall.rb' - - 'Homebrew/cmd/search.rb' - - 'Homebrew/cmd/tap-info.rb' - - 'Homebrew/cmd/unlinkapps.rb' - - 'Homebrew/cmd/update-report.rb' - - 'Homebrew/cmd/upgrade.rb' - - 'Homebrew/cmd/uses.rb' - - 'Homebrew/compilers.rb' - - 'Homebrew/debrew.rb' - - 'Homebrew/descriptions.rb' - - 'Homebrew/dev-cmd/aspell-dictionaries.rb' - - 'Homebrew/dev-cmd/audit.rb' - - 'Homebrew/dev-cmd/bottle.rb' - - 'Homebrew/dev-cmd/edit.rb' - - 'Homebrew/dev-cmd/man.rb' - - 'Homebrew/diagnostic.rb' - - 'Homebrew/exceptions.rb' - - 'Homebrew/extend/ARGV.rb' - - 'Homebrew/extend/ENV/shared.rb' - - 'Homebrew/extend/ENV/std.rb' - - 'Homebrew/extend/fileutils.rb' - - 'Homebrew/extend/os/mac/formula_cellar_checks.rb' - - 'Homebrew/extend/pathname.rb' - - 'Homebrew/formula.rb' - - 'Homebrew/formula_assertions.rb' - - 'Homebrew/formula_cellar_checks.rb' - - 'Homebrew/formula_installer.rb' - - 'Homebrew/formulary.rb' - - 'Homebrew/global.rb' - - 'Homebrew/keg.rb' - - 'Homebrew/language/haskell.rb' - - 'Homebrew/language/node.rb' - - 'Homebrew/language/python.rb' - - 'Homebrew/migrator.rb' - - 'Homebrew/os/mac/linkage_checker.rb' - - 'Homebrew/os/mac/xquartz.rb' - - 'Homebrew/patch.rb' - - 'Homebrew/readall.rb' - - 'Homebrew/software_spec.rb' - - 'Homebrew/tap.rb' - - 'Homebrew/test/lib/config.rb' - - 'Homebrew/test/test_ARGV.rb' - - 'Homebrew/test/test_cleanup.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_migrator.rb' - - 'Homebrew/test/test_pathname.rb' - - 'Homebrew/test/test_tap.rb' - - 'Homebrew/test/test_utils.rb' - - 'Homebrew/test/testing_env.rb' - - 'Homebrew/utils.rb' - - 'Homebrew/utils/github.rb' - -# Offense count: 7 -Style/ClassVars: - Exclude: - - 'Homebrew/dev-cmd/audit.rb' - - 'Homebrew/formula_installer.rb' - - 'Homebrew/test/testing_env.rb' - - 'Homebrew/utils.rb' - -# Offense count: 13 -# Configuration parameters: AllowedVariables. -Style/GlobalVars: - Exclude: - - 'Homebrew/diagnostic.rb' - - 'Homebrew/utils.rb' - -# Offense count: 2 -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: module_function, extend_self -Style/ModuleFunction: - Exclude: - - 'Homebrew/global.rb' - - 'Homebrew/os/mac/xcode.rb' - -# Offense count: 8 -Style/MultilineBlockChain: - Exclude: - - 'Homebrew/cmd/search.rb' - - 'Homebrew/dev-cmd/aspell-dictionaries.rb' - - 'Homebrew/dev-cmd/audit.rb' - - 'Homebrew/dev-cmd/man.rb' - - 'Homebrew/diagnostic.rb' - - 'Homebrew/test/test_patching.rb' - -# Offense count: 4 -# Cop supports --auto-correct. -Style/MutableConstant: - Exclude: - - 'Homebrew/dependency_collector.rb' - - 'Homebrew/formulary.rb' - - 'Homebrew/tab.rb' - - 'Homebrew/tap.rb' - -# Offense count: 8 -Style/OpMethod: - Exclude: - - 'Homebrew/dependencies.rb' - - 'Homebrew/install_renamed.rb' - - 'Homebrew/options.rb' diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml new file mode 100644 index 000000000..f4f80800a --- /dev/null +++ b/Library/Homebrew/.rubocop.yml @@ -0,0 +1,112 @@ +inherit_from: + - ../.rubocop.yml + - .rubocop_todo.yml + +AllCops: + Include: + - '**/.simplecov' + Exclude: + - 'cask/**/*' + - '**/vendor/**/*' + +# `formula do` uses nested method definitions +Lint/NestedMethodDefinition: + Exclude: + - 'test/**/*' + +Metrics/ModuleLength: + CountComments: false + Exclude: + - 'cask/lib/hbc/locations.rb' + - 'cask/lib/hbc/macos.rb' + - '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: + - 'compat/**/*' + +# we won't change backward compatible predicate names +Style/PredicateName: + Exclude: + - 'compat/**/*' + NameWhitelist: is_32_bit?, is_64_bit? + diff --git a/Library/Homebrew/.rubocop_todo.yml b/Library/Homebrew/.rubocop_todo.yml new file mode 100644 index 000000000..4c6a4bbc5 --- /dev/null +++ b/Library/Homebrew/.rubocop_todo.yml @@ -0,0 +1,211 @@ +# This configuration was generated by +# `rubocop --auto-gen-config --exclude-limit 100` +# on 2016-09-28 22:26:33 +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 +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 16 +Lint/HandleExceptions: + Exclude: + - 'cmd/install.rb' + - 'cmd/reinstall.rb' + - 'cmd/tap.rb' + - 'cmd/update-report.rb' + - 'cmd/upgrade.rb' + - 'cmd/uses.rb' + - 'descriptions.rb' + - 'diagnostic.rb' + - 'extend/ENV/super.rb' + - 'extend/pathname.rb' + - 'formula.rb' + - 'formula_versions.rb' + - 'test/test_ENV.rb' + +# Offense count: 3 +Lint/IneffectiveAccessModifier: + Exclude: + - 'formula.rb' + - 'version.rb' + +# Offense count: 1 +Lint/Loop: + Exclude: + - 'patch.rb' + +# Offense count: 28 +Lint/RescueException: + Exclude: + - 'brew.rb' + - 'build.rb' + - 'cmd/fetch.rb' + - 'cmd/reinstall.rb' + - 'cmd/update-report.rb' + - 'debrew.rb' + - 'dev-cmd/pull.rb' + - 'dev-cmd/test.rb' + - 'formula.rb' + - 'formula_installer.rb' + - 'migrator.rb' + - 'postinstall.rb' + - 'readall.rb' + - 'test.rb' + - 'test/test_ENV.rb' + - 'utils/fork.rb' + +# Offense count: 1 +Lint/ShadowedException: + Exclude: + - 'utils/fork.rb' + +# Offense count: 14 +Metrics/BlockNesting: + Max: 5 + +# Offense count: 19 +# Configuration parameters: CountComments. +Metrics/ModuleLength: + Max: 366 + +# Offense count: 2 +# Configuration parameters: CountKeywordArgs. +Metrics/ParameterLists: + Max: 6 + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: percent_q, bare_percent +Style/BarePercentLiterals: + Exclude: + - 'dev-cmd/audit.rb' + - 'test/test_diagnostic.rb' + - 'test/test_exceptions.rb' + - 'test/test_patch.rb' + - 'test/test_string.rb' + +# Offense count: 134 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods. +# SupportedStyles: line_count_based, semantic, braces_for_chaining +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# IgnoredMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'caveats.rb' + - 'cleaner.rb' + - 'cleanup.rb' + - 'cmd/deps.rb' + - 'cmd/desc.rb' + - 'cmd/fetch.rb' + - 'cmd/help.rb' + - 'cmd/info.rb' + - 'cmd/linkapps.rb' + - 'cmd/list.rb' + - 'cmd/outdated.rb' + - 'cmd/reinstall.rb' + - 'cmd/search.rb' + - 'cmd/tap-info.rb' + - 'cmd/unlinkapps.rb' + - 'cmd/update-report.rb' + - 'cmd/upgrade.rb' + - 'cmd/uses.rb' + - 'compilers.rb' + - 'debrew.rb' + - 'descriptions.rb' + - 'dev-cmd/aspell-dictionaries.rb' + - 'dev-cmd/audit.rb' + - 'dev-cmd/bottle.rb' + - 'dev-cmd/edit.rb' + - 'dev-cmd/man.rb' + - 'diagnostic.rb' + - 'exceptions.rb' + - 'extend/ARGV.rb' + - 'extend/ENV/shared.rb' + - 'extend/ENV/std.rb' + - 'extend/fileutils.rb' + - 'extend/os/mac/formula_cellar_checks.rb' + - 'extend/pathname.rb' + - 'formula.rb' + - 'formula_assertions.rb' + - 'formula_cellar_checks.rb' + - 'formula_installer.rb' + - 'formulary.rb' + - 'global.rb' + - 'keg.rb' + - 'language/haskell.rb' + - 'language/node.rb' + - 'language/python.rb' + - 'migrator.rb' + - 'os/mac/linkage_checker.rb' + - 'os/mac/xquartz.rb' + - 'patch.rb' + - 'readall.rb' + - 'software_spec.rb' + - 'tap.rb' + - 'test/lib/config.rb' + - 'test/test_ARGV.rb' + - 'test/test_cleanup.rb' + - 'test/test_dependency_collector.rb' + - 'test/test_formula_installer.rb' + - 'test/test_formula_installer_bottle.rb' + - 'test/test_formulary.rb' + - 'test/test_gpg.rb' + - 'test/test_migrator.rb' + - 'test/test_pathname.rb' + - 'test/test_tap.rb' + - 'test/test_utils.rb' + - 'test/testing_env.rb' + - 'utils.rb' + - 'utils/github.rb' + +# Offense count: 7 +Style/ClassVars: + Exclude: + - 'dev-cmd/audit.rb' + - 'formula_installer.rb' + - 'test/testing_env.rb' + - 'utils.rb' + +# Offense count: 13 +# Configuration parameters: AllowedVariables. +Style/GlobalVars: + Exclude: + - 'diagnostic.rb' + - 'utils.rb' + +# Offense count: 2 +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: module_function, extend_self +Style/ModuleFunction: + Exclude: + - 'global.rb' + - 'os/mac/xcode.rb' + +# Offense count: 8 +Style/MultilineBlockChain: + Exclude: + - 'cmd/search.rb' + - 'dev-cmd/aspell-dictionaries.rb' + - 'dev-cmd/audit.rb' + - 'dev-cmd/man.rb' + - 'diagnostic.rb' + - 'test/test_patching.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Style/MutableConstant: + Exclude: + - 'dependency_collector.rb' + - 'formulary.rb' + - 'tab.rb' + - 'tap.rb' + +# Offense count: 8 +Style/OpMethod: + Exclude: + - 'dependencies.rb' + - 'install_renamed.rb' + - 'options.rb' diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index 1a4b02277..d396f81ee 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -53,10 +53,10 @@ module Homebrew args << "--auto-correct" if fix if files.nil? - args << "--config" << HOMEBREW_LIBRARY/".rubocop_core.yml" + args << "--config" << HOMEBREW_LIBRARY_PATH/".rubocop.yml" args += [HOMEBREW_LIBRARY_PATH] else - args << "--config" << HOMEBREW_LIBRARY/".rubocop_formula.yml" + args << "--config" << HOMEBREW_LIBRARY/"Taps/.rubocop.yml" args += files end -- cgit v1.2.3 From 18a9945ad8aa3bbe71512d1422e562ef3eee3ee5 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 28 Sep 2016 22:47:14 +0200 Subject: `cd` to `HOMEBREW_LIBRARY` is not needed anymore for RuboCop. --- Library/Homebrew/cmd/style.rb | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index d396f81ee..e44641f70 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -56,26 +56,25 @@ module Homebrew args << "--config" << HOMEBREW_LIBRARY_PATH/".rubocop.yml" args += [HOMEBREW_LIBRARY_PATH] else - args << "--config" << HOMEBREW_LIBRARY/"Taps/.rubocop.yml" + args << "--config" << Tap::TAP_DIRECTORY/".rubocop.yml" + args << "--format" << "simple" args += files end - HOMEBREW_LIBRARY.cd do - case output_type - when :print - args << "--display-cop-names" if ARGV.include? "--display-cop-names" - system "rubocop", "--format", "simple", *args - !$?.success? - when :json - json = Utils.popen_read_text("rubocop", "--format", "json", *args) - # exit status of 1 just means violations were found; other numbers mean execution errors - # exitstatus can also be nil if RuboCop process crashes, e.g. due to - # native extension problems - raise "Error while running RuboCop" if $?.exitstatus.nil? || $?.exitstatus > 1 - RubocopResults.new(Utils::JSON.load(json)) - else - raise "Invalid output_type for check_style_impl: #{output_type}" - end + case output_type + when :print + args << "--display-cop-names" if ARGV.include? "--display-cop-names" + system "rubocop", *args + !$?.success? + when :json + json = Utils.popen_read_text("rubocop", "--format", "json", *args) + # exit status of 1 just means violations were found; other numbers mean execution errors + # exitstatus can also be nil if RuboCop process crashes, e.g. due to + # native extension problems + raise "Error while running RuboCop" if $?.exitstatus.nil? || $?.exitstatus > 1 + RubocopResults.new(Utils::JSON.load(json)) + else + raise "Invalid output_type for check_style_impl: #{output_type}" end end -- cgit v1.2.3 From cea796c09bf3277b31029c4c417315e534d443d1 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 29 Sep 2016 22:59:49 +0200 Subject: Rename shared RuboCop config to `.rubocop_common.yml`. --- Library/.rubocop.yml | 147 ------------------------------------------ Library/.rubocop_common.yml | 147 ++++++++++++++++++++++++++++++++++++++++++ Library/Homebrew/.rubocop.yml | 2 +- 3 files changed, 148 insertions(+), 148 deletions(-) delete mode 100644 Library/.rubocop.yml create mode 100644 Library/.rubocop_common.yml (limited to 'Library') diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml deleted file mode 100644 index 3563acf1f..000000000 --- a/Library/.rubocop.yml +++ /dev/null @@ -1,147 +0,0 @@ -AllCops: - TargetRubyVersion: 2.0 - -Metrics/AbcSize: - Enabled: false - -Metrics/ClassLength: - Enabled: false - -Metrics/CyclomaticComplexity: - Enabled: false - -Metrics/LineLength: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -Metrics/ModuleLength: - CountComments: false - -Metrics/PerceivedComplexity: - Enabled: false - -# favor parens-less DSL-style arguments -Lint/AmbiguousOperator: - Enabled: false - -Lint/AmbiguousRegexpLiteral: - Enabled: false - -Lint/AssignmentInCondition: - Enabled: false - -Lint/EndAlignment: - AlignWith: variable - -Lint/ParenthesesAsGroupedExpression: - Enabled: false - -Style/Alias: - EnforcedStyle: prefer_alias - -Style/AlignHash: - Enabled: false - -# `system` is a special case and aligns on second argument -Style/AlignParameters: - Enabled: false - -Style/CaseIndentation: - IndentWhenRelativeTo: end - -Style/ClassAndModuleChildren: - EnforcedStyle: nested - -# percent-x is allowed for multiline -Style/CommandLiteral: - EnforcedStyle: mixed - -# our current conditional style is established, clear and -# requiring users to change that now would be confusing. -Style/ConditionalAssignment: - Enabled: false - -Style/Documentation: - Enabled: false - -Style/EmptyLineBetweenDefs: - AllowAdjacentOneLineDefs: true - -# dashes in filenames are typical -Style/FileName: - Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/ - -Style/IndentArray: - EnforcedStyle: special_inside_parentheses - -# only for numbers >= 1_000_000 -Style/NumericLiterals: - MinDigits: 7 - -# zero-prefixed octal literals are just too widely used (and mostly understood) -Style/NumericLiteralPrefix: - EnforcedOctalStyle: zero_only - -# consistency and readability when faced with string interpolation -Style/PercentLiteralDelimiters: - PreferredDelimiters: - '%': '()' - '%i': '()' - '%q': '()' - '%Q': '()' - '%r': '{}' - '%s': '()' - '%w': '[]' - '%W': '[]' - '%x': '()' - -# we prefer Perl-style regex back references -Style/PerlBackrefs: - Enabled: false - -Style/RaiseArgs: - EnforcedStyle: exploded - -# paths abound, easy escape -Style/RegexpLiteral: - EnforcedStyle: slashes - -# conflicts with DSL-style path concatenation with `/` -Style/SpaceAroundOperators: - Enabled: false - -# not a problem for typical shell users -Style/SpecialGlobalVars: - Enabled: false - -# ruby style guide favorite -Style/StringLiterals: - EnforcedStyle: double_quotes - -# consistency with above -Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes - -# TODO: enforce when rubocop has shipped this -# https://github.com/bbatsov/rubocop/pull/3513 -Style/TernaryParentheses: - Enabled: false - -# makes diffs nicer -Style/TrailingCommaInLiteral: - EnforcedStyleForMultiline: comma - -Style/UnneededCapitalW: - Enabled: false - -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/3516 -Style/VariableNumber: - Enabled: false - -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/1543 -Style/WordArray: - Enabled: false diff --git a/Library/.rubocop_common.yml b/Library/.rubocop_common.yml new file mode 100644 index 000000000..3563acf1f --- /dev/null +++ b/Library/.rubocop_common.yml @@ -0,0 +1,147 @@ +AllCops: + TargetRubyVersion: 2.0 + +Metrics/AbcSize: + Enabled: false + +Metrics/ClassLength: + Enabled: false + +Metrics/CyclomaticComplexity: + Enabled: false + +Metrics/LineLength: + Enabled: false + +Metrics/MethodLength: + Enabled: false + +Metrics/ModuleLength: + CountComments: false + +Metrics/PerceivedComplexity: + Enabled: false + +# favor parens-less DSL-style arguments +Lint/AmbiguousOperator: + Enabled: false + +Lint/AmbiguousRegexpLiteral: + Enabled: false + +Lint/AssignmentInCondition: + Enabled: false + +Lint/EndAlignment: + AlignWith: variable + +Lint/ParenthesesAsGroupedExpression: + Enabled: false + +Style/Alias: + EnforcedStyle: prefer_alias + +Style/AlignHash: + Enabled: false + +# `system` is a special case and aligns on second argument +Style/AlignParameters: + Enabled: false + +Style/CaseIndentation: + IndentWhenRelativeTo: end + +Style/ClassAndModuleChildren: + EnforcedStyle: nested + +# percent-x is allowed for multiline +Style/CommandLiteral: + EnforcedStyle: mixed + +# our current conditional style is established, clear and +# requiring users to change that now would be confusing. +Style/ConditionalAssignment: + Enabled: false + +Style/Documentation: + Enabled: false + +Style/EmptyLineBetweenDefs: + AllowAdjacentOneLineDefs: true + +# dashes in filenames are typical +Style/FileName: + Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/ + +Style/IndentArray: + EnforcedStyle: special_inside_parentheses + +# only for numbers >= 1_000_000 +Style/NumericLiterals: + MinDigits: 7 + +# zero-prefixed octal literals are just too widely used (and mostly understood) +Style/NumericLiteralPrefix: + EnforcedOctalStyle: zero_only + +# consistency and readability when faced with string interpolation +Style/PercentLiteralDelimiters: + PreferredDelimiters: + '%': '()' + '%i': '()' + '%q': '()' + '%Q': '()' + '%r': '{}' + '%s': '()' + '%w': '[]' + '%W': '[]' + '%x': '()' + +# we prefer Perl-style regex back references +Style/PerlBackrefs: + Enabled: false + +Style/RaiseArgs: + EnforcedStyle: exploded + +# paths abound, easy escape +Style/RegexpLiteral: + EnforcedStyle: slashes + +# conflicts with DSL-style path concatenation with `/` +Style/SpaceAroundOperators: + Enabled: false + +# not a problem for typical shell users +Style/SpecialGlobalVars: + Enabled: false + +# ruby style guide favorite +Style/StringLiterals: + EnforcedStyle: double_quotes + +# consistency with above +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes + +# TODO: enforce when rubocop has shipped this +# https://github.com/bbatsov/rubocop/pull/3513 +Style/TernaryParentheses: + Enabled: false + +# makes diffs nicer +Style/TrailingCommaInLiteral: + EnforcedStyleForMultiline: comma + +Style/UnneededCapitalW: + Enabled: false + +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/3516 +Style/VariableNumber: + Enabled: false + +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/1543 +Style/WordArray: + Enabled: false diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index f4f80800a..0b5d67521 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -1,5 +1,5 @@ inherit_from: - - ../.rubocop.yml + - ../.rubocop_common.yml - .rubocop_todo.yml AllCops: -- cgit v1.2.3 From 5b31507fdac6ae12141b3e84f70115610a7ae00c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 1 Oct 2016 12:13:09 +0100 Subject: Use Library/.rubocop.yml file. This allows having a shared style that’s use for Homebrew/brew and taps which can be overridden by Homebrew/brew. --- Library/.rubocop.yml | 156 ++++++++++++++++++++++++++++++++++++++++++ Library/.rubocop_common.yml | 147 --------------------------------------- Library/Homebrew/.rubocop.yml | 2 +- Library/Homebrew/cmd/style.rb | 2 +- 4 files changed, 158 insertions(+), 149 deletions(-) create mode 100644 Library/.rubocop.yml delete mode 100644 Library/.rubocop_common.yml (limited to 'Library') diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml new file mode 100644 index 000000000..2fe239447 --- /dev/null +++ b/Library/.rubocop.yml @@ -0,0 +1,156 @@ +AllCops: + TargetRubyVersion: 2.0 + +Metrics/AbcSize: + Enabled: false + +Metrics/ClassLength: + Enabled: false + +Metrics/CyclomaticComplexity: + Enabled: false + +Metrics/LineLength: + Enabled: false + +Metrics/MethodLength: + Enabled: false + +Metrics/ModuleLength: + CountComments: false + +Metrics/PerceivedComplexity: + Enabled: false + +# favor parens-less DSL-style arguments +Lint/AmbiguousOperator: + Enabled: false + +Lint/AmbiguousRegexpLiteral: + Enabled: false + +Lint/AssignmentInCondition: + Enabled: false + +Lint/EndAlignment: + AlignWith: variable + +Lint/ParenthesesAsGroupedExpression: + Enabled: false + +Style/Alias: + EnforcedStyle: prefer_alias + +Style/AlignHash: + Enabled: false + +# `system` is a special case and aligns on second argument +Style/AlignParameters: + Enabled: false + +Style/CaseIndentation: + IndentWhenRelativeTo: end + +Style/ClassAndModuleChildren: + EnforcedStyle: nested + +# percent-x is allowed for multiline +Style/CommandLiteral: + EnforcedStyle: mixed + +# our current conditional style is established, clear and +# requiring users to change that now would be confusing. +Style/ConditionalAssignment: + Enabled: false + +Style/Documentation: + Enabled: false + +Style/EmptyLineBetweenDefs: + AllowAdjacentOneLineDefs: true + +# dashes in filenames are typical +Style/FileName: + Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/ + +Style/GuardClause: + Enabled: false + +Style/HashSyntax: + EnforcedStyle: hash_rockets + +Style/IfUnlessModifier: + Enabled: false + +Style/IndentArray: + EnforcedStyle: special_inside_parentheses + +# only for numbers >= 1_000_000 +Style/NumericLiterals: + MinDigits: 7 + +# zero-prefixed octal literals are just too widely used (and mostly understood) +Style/NumericLiteralPrefix: + EnforcedOctalStyle: zero_only + +# consistency and readability when faced with string interpolation +Style/PercentLiteralDelimiters: + PreferredDelimiters: + '%': '()' + '%i': '()' + '%q': '()' + '%Q': '()' + '%r': '{}' + '%s': '()' + '%w': '[]' + '%W': '[]' + '%x': '()' + +# we prefer Perl-style regex back references +Style/PerlBackrefs: + Enabled: false + +Style/RaiseArgs: + EnforcedStyle: exploded + +# paths abound, easy escape +Style/RegexpLiteral: + EnforcedStyle: slashes + +# conflicts with DSL-style path concatenation with `/` +Style/SpaceAroundOperators: + Enabled: false + +# not a problem for typical shell users +Style/SpecialGlobalVars: + Enabled: false + +# ruby style guide favorite +Style/StringLiterals: + EnforcedStyle: double_quotes + +# consistency with above +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes + +# TODO: enforce when rubocop has shipped this +# https://github.com/bbatsov/rubocop/pull/3513 +Style/TernaryParentheses: + Enabled: false + +# makes diffs nicer +Style/TrailingCommaInLiteral: + EnforcedStyleForMultiline: comma + +Style/UnneededCapitalW: + Enabled: false + +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/3516 +Style/VariableNumber: + Enabled: false + +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/1543 +Style/WordArray: + Enabled: false diff --git a/Library/.rubocop_common.yml b/Library/.rubocop_common.yml deleted file mode 100644 index 3563acf1f..000000000 --- a/Library/.rubocop_common.yml +++ /dev/null @@ -1,147 +0,0 @@ -AllCops: - TargetRubyVersion: 2.0 - -Metrics/AbcSize: - Enabled: false - -Metrics/ClassLength: - Enabled: false - -Metrics/CyclomaticComplexity: - Enabled: false - -Metrics/LineLength: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -Metrics/ModuleLength: - CountComments: false - -Metrics/PerceivedComplexity: - Enabled: false - -# favor parens-less DSL-style arguments -Lint/AmbiguousOperator: - Enabled: false - -Lint/AmbiguousRegexpLiteral: - Enabled: false - -Lint/AssignmentInCondition: - Enabled: false - -Lint/EndAlignment: - AlignWith: variable - -Lint/ParenthesesAsGroupedExpression: - Enabled: false - -Style/Alias: - EnforcedStyle: prefer_alias - -Style/AlignHash: - Enabled: false - -# `system` is a special case and aligns on second argument -Style/AlignParameters: - Enabled: false - -Style/CaseIndentation: - IndentWhenRelativeTo: end - -Style/ClassAndModuleChildren: - EnforcedStyle: nested - -# percent-x is allowed for multiline -Style/CommandLiteral: - EnforcedStyle: mixed - -# our current conditional style is established, clear and -# requiring users to change that now would be confusing. -Style/ConditionalAssignment: - Enabled: false - -Style/Documentation: - Enabled: false - -Style/EmptyLineBetweenDefs: - AllowAdjacentOneLineDefs: true - -# dashes in filenames are typical -Style/FileName: - Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/ - -Style/IndentArray: - EnforcedStyle: special_inside_parentheses - -# only for numbers >= 1_000_000 -Style/NumericLiterals: - MinDigits: 7 - -# zero-prefixed octal literals are just too widely used (and mostly understood) -Style/NumericLiteralPrefix: - EnforcedOctalStyle: zero_only - -# consistency and readability when faced with string interpolation -Style/PercentLiteralDelimiters: - PreferredDelimiters: - '%': '()' - '%i': '()' - '%q': '()' - '%Q': '()' - '%r': '{}' - '%s': '()' - '%w': '[]' - '%W': '[]' - '%x': '()' - -# we prefer Perl-style regex back references -Style/PerlBackrefs: - Enabled: false - -Style/RaiseArgs: - EnforcedStyle: exploded - -# paths abound, easy escape -Style/RegexpLiteral: - EnforcedStyle: slashes - -# conflicts with DSL-style path concatenation with `/` -Style/SpaceAroundOperators: - Enabled: false - -# not a problem for typical shell users -Style/SpecialGlobalVars: - Enabled: false - -# ruby style guide favorite -Style/StringLiterals: - EnforcedStyle: double_quotes - -# consistency with above -Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes - -# TODO: enforce when rubocop has shipped this -# https://github.com/bbatsov/rubocop/pull/3513 -Style/TernaryParentheses: - Enabled: false - -# makes diffs nicer -Style/TrailingCommaInLiteral: - EnforcedStyleForMultiline: comma - -Style/UnneededCapitalW: - Enabled: false - -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/3516 -Style/VariableNumber: - Enabled: false - -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/1543 -Style/WordArray: - Enabled: false diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index 0b5d67521..f4f80800a 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -1,5 +1,5 @@ inherit_from: - - ../.rubocop_common.yml + - ../.rubocop.yml - .rubocop_todo.yml AllCops: diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index e44641f70..9934c6939 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -56,7 +56,7 @@ module Homebrew args << "--config" << HOMEBREW_LIBRARY_PATH/".rubocop.yml" args += [HOMEBREW_LIBRARY_PATH] else - args << "--config" << Tap::TAP_DIRECTORY/".rubocop.yml" + args << "--config" << HOMEBREW_LIBRARY/".rubocop.yml" args << "--format" << "simple" args += files end -- cgit v1.2.3 From 84c29fcf1ff29df31ab98b03ed4cedf9222ce161 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 1 Oct 2016 17:04:44 +0100 Subject: Fix JSON output handling. --- Library/Homebrew/cmd/style.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library') diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index 9934c6939..e666eb200 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -57,13 +57,13 @@ module Homebrew args += [HOMEBREW_LIBRARY_PATH] else args << "--config" << HOMEBREW_LIBRARY/".rubocop.yml" - args << "--format" << "simple" args += files end case output_type when :print args << "--display-cop-names" if ARGV.include? "--display-cop-names" + args << "--format" << "simple" if files system "rubocop", *args !$?.success? when :json -- cgit v1.2.3