diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 33277ac7c723038e051980bfd4f1bf1349567443..d6dc0c4295d26bea8c820b12f960a4644bddbc07 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -1,4 +1,6 @@ -inherit_from: .rubocop_todo.yml +inherit_from: + - .rubocop_rules.yml + - .rubocop_todo.yml AllCops: TargetRubyVersion: 2.0 @@ -6,129 +8,3 @@ AllCops: - 'Homebrew/cask/**/*' - 'Homebrew/vendor/**/*' - 'Homebrew/test/vendor/**/*' - -# ruby style guide favorite -Style/StringLiterals: - EnforcedStyle: double_quotes - -# consistency with above -Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes - -# percent-x is allowed for multiline -Style/CommandLiteral: - EnforcedStyle: mixed - -# paths abound, easy escape -Style/RegexpLiteral: - EnforcedStyle: slashes - -# too prevalent to change this now, but might be discussed/changed later -Style/Alias: - EnforcedStyle: prefer_alias_method - -# our current conditional style is established, clear and -# requiring users to change that now would be confusing. -Style/ConditionalAssignment: - Enabled: false - -# no metrics for formulas -Metrics/AbcSize: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false - -# we often need very long lines -Metrics/LineLength: - Enabled: false - -# formulas have no mandatory doc -Style/Documentation: - Enabled: false - -# favor parens-less DSL-style arguments -Lint/AmbiguousOperator: - Enabled: false -Lint/AmbiguousRegexpLiteral: - Enabled: false -Lint/AssignmentInCondition: - Enabled: false -Lint/ParenthesesAsGroupedExpression: - Enabled: false - -# compact style -Style/EmptyLineBetweenDefs: - AllowAdjacentOneLineDefs: true - -# port numbers and such tech stuff -Style/NumericLiterals: - Enabled: false - -# 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': '()' - -# conflicts with DSL-style path concatenation with `/` -Style/SpaceAroundOperators: - Enabled: false - -# not a problem for typical shell users -Style/SpecialGlobalVars: - Enabled: false - -# `system` is a special case and aligns on second argument -Style/AlignParameters: - Enabled: false - -# counterproductive in formulas, notably within the install method -Style/GuardClause: - Enabled: false -Style/IfUnlessModifier: - Enabled: false - -# dashes in filenames are typical -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/1545 -Style/FileName: - Enabled: false - -# no percent word array, being friendly to non-ruby users -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/1543 -Style/WordArray: - Enabled: false -Style/UnneededCapitalW: - Enabled: false - -# we prefer compact if-else-end/case-when-end alignment -Lint/EndAlignment: - AlignWith: variable -Style/CaseIndentation: - IndentWhenRelativeTo: end - -# we prefer Perl-style regex back references -Style/PerlBackrefs: - Enabled: false - -# makes diffs nicer -Style/TrailingCommaInLiteral: - EnforcedStyleForMultiline: comma diff --git a/Library/.rubocop_rules.yml b/Library/.rubocop_rules.yml new file mode 100644 index 0000000000000000000000000000000000000000..cde31093031b363b08683ae1d04b5bd006cd8ae8 --- /dev/null +++ b/Library/.rubocop_rules.yml @@ -0,0 +1,141 @@ + +# ruby style guide favorite +Style/StringLiterals: + EnforcedStyle: double_quotes + +# consistency with above +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes + +# percent-x is allowed for multiline +Style/CommandLiteral: + EnforcedStyle: mixed + +# paths abound, easy escape +Style/RegexpLiteral: + EnforcedStyle: slashes + +# too prevalent to change this now, but might be discussed/changed later +Style/Alias: + EnforcedStyle: prefer_alias_method + +# our current conditional style is established, clear and +# requiring users to change that now would be confusing. +Style/ConditionalAssignment: + Enabled: false + +# no metrics for formulas +Metrics/AbcSize: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false + +# we often need very long lines +Metrics/LineLength: + Enabled: false + +# formulas have no mandatory doc +Style/Documentation: + Enabled: false + +# favor parens-less DSL-style arguments +Lint/AmbiguousOperator: + Enabled: false +Lint/AmbiguousRegexpLiteral: + Enabled: false +Lint/AssignmentInCondition: + Enabled: false +Lint/ParenthesesAsGroupedExpression: + Enabled: false + +# compact style +Style/EmptyLineBetweenDefs: + AllowAdjacentOneLineDefs: true + +# port numbers and such tech stuff +Style/NumericLiterals: + Enabled: false + +# 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': '()' + +# conflicts with DSL-style path concatenation with `/` +Style/SpaceAroundOperators: + Enabled: false + +# not a problem for typical shell users +Style/SpecialGlobalVars: + Enabled: false + +# `system` is a special case and aligns on second argument +Style/AlignParameters: + Enabled: false + +# counterproductive in formulas, notably within the install method +Style/GuardClause: + Enabled: false +Style/IfUnlessModifier: + Enabled: false + +# dashes in filenames are typical +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/1545 +Style/FileName: + Enabled: false + +# no percent word array, being friendly to non-ruby users +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/1543 +Style/WordArray: + Enabled: false +Style/UnneededCapitalW: + Enabled: false + +# we prefer compact if-else-end/case-when-end alignment +Lint/EndAlignment: + AlignWith: variable +Style/CaseIndentation: + IndentWhenRelativeTo: end + +# we prefer Perl-style regex back references +Style/PerlBackrefs: + Enabled: false + +# makes diffs nicer +Style/TrailingCommaInLiteral: + EnforcedStyleForMultiline: comma + +# 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/**/*' + +# `formula do` uses nested method definitions +Lint/NestedMethodDefinition: + Exclude: + - 'Homebrew/test/**/*' diff --git a/Library/.rubocop_todo.yml b/Library/.rubocop_todo.yml index 18b69e207e7633bf21aff482dd71e82e2a00b535..a898d2f799cbffe1d7610fb94947c05424f5c4e1 100644 --- a/Library/.rubocop_todo.yml +++ b/Library/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by -# `rubocop --auto-gen-config` -# on 2016-09-17 15:44:31 +0100 using RuboCop version 0.42.0. +# `rubocop --auto-gen-config --exclude-limit 30` +# on 2016-09-18 15:15:22 +0100 using RuboCop version 0.41.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 @@ -48,6 +48,7 @@ Lint/Loop: # Offense count: 6 Lint/NestedMethodDefinition: Exclude: + - 'Homebrew/test/**/*' - 'Homebrew/dev-cmd/bottle.rb' - 'Homebrew/dev-cmd/test-bot.rb' @@ -58,7 +59,23 @@ Lint/NonLocalExitFromIterator: # Offense count: 28 Lint/RescueException: - Enabled: false + 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: @@ -77,7 +94,7 @@ Metrics/BlockNesting: # Offense count: 20 # Configuration parameters: CountComments. Metrics/ModuleLength: - Max: 369 + Max: 400 # Offense count: 1 # Configuration parameters: CountKeywordArgs. @@ -110,7 +127,23 @@ Style/Alias: # Offense count: 26 Style/CaseEquality: - Enabled: false + Exclude: + - 'Homebrew/cleanup.rb' + - 'Homebrew/cmd/search.rb' + - 'Homebrew/compilers.rb' + - 'Homebrew/cxxstdlib.rb' + - 'Homebrew/debrew.rb' + - 'Homebrew/dependencies.rb' + - 'Homebrew/dependency_collector.rb' + - 'Homebrew/download_strategy.rb' + - 'Homebrew/formula.rb' + - 'Homebrew/options.rb' + - 'Homebrew/patch.rb' + - 'Homebrew/pkg_version.rb' + - 'Homebrew/requirement.rb' + - 'Homebrew/requirements.rb' + - 'Homebrew/software_spec.rb' + - 'Homebrew/version.rb' # Offense count: 1 # Cop supports --auto-correct. @@ -170,6 +203,7 @@ Style/IdenticalConditionalBranches: # SupportedStyles: snake_case, camelCase Style/MethodName: Exclude: + - 'Homebrew/compat/**/*' - 'Homebrew/cleanup.rb' - 'Homebrew/diagnostic.rb' - 'Homebrew/formula_cellar_checks.rb' @@ -230,7 +264,7 @@ Style/OpMethod: # NameWhitelist: is_a? Style/PredicateName: Exclude: - - 'spec/**/*' + - 'Homebrew/compat/**/*' - 'Homebrew/download_strategy.rb' - 'Homebrew/hardware.rb' diff --git a/Library/Homebrew/compat/.rubocop.yml b/Library/Homebrew/compat/.rubocop.yml deleted file mode 100644 index c07e248914cd51e267317048d51292a4479a8964..0000000000000000000000000000000000000000 --- a/Library/Homebrew/compat/.rubocop.yml +++ /dev/null @@ -1,7 +0,0 @@ -inherit_from: ../../.rubocop.yml - -# We won't change method or predicate names because of backward compatibility. -Style/MethodName: - Enabled: false -Style/PredicateName: - Enabled: false diff --git a/Library/Homebrew/test/.rubocop.yml b/Library/Homebrew/test/.rubocop.yml deleted file mode 100644 index 6f1bcba97337c92f4cbbd57eb881a62aeb0b8894..0000000000000000000000000000000000000000 --- a/Library/Homebrew/test/.rubocop.yml +++ /dev/null @@ -1,5 +0,0 @@ -inherit_from: ../../.rubocop.yml - -# `formula do` uses nested method definitions -Lint/NestedMethodDefinition: - Enabled: false