blob: 8f85f1d9f815451a20a3eb9c905fdfc22e01fab2 [file] [log] [blame]
# BSD 2-Clause License
# Copyright (c) 2009-present, Homebrew contributors
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Taken from Homebrew @ Dec 3, 2018. Modified to pass yamllint
#
---
AllCops:
NewCops: disable
# make our hashes consistent
Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
# `system` is a special case and aligns on second argument
Layout/ParameterAlignment:
Enabled: false
# favour parens-less DSL-style arguments
Lint/AmbiguousOperator:
Enabled: false
# this is a bit less "floaty"
Layout/CaseIndentation:
EnforcedStyle: end
# this is a bit less "floaty"
Layout/EndAlignment:
EnforcedStyleAlignWith: start_of_line
# conflicts with DSL-style path concatenation with `/`
Layout/SpaceAroundOperators:
Enabled: false
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6300).
Layout/EmptyLineAfterGuardClause:
Enabled: false
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6258)
# and layout is not configurable
# (https://github.com/rubocop-hq/rubocop/issues/6254).
Layout/RescueEnsureAlignment:
Enabled: false
# favour parens-less DSL-style arguments
Lint/AmbiguousBlockAssociation:
Enabled: false
# so many of these in formulae and can't be autocorrected
# TODO: fix these as `ruby -w` complains about them.
Lint/AmbiguousRegexpLiteral:
Enabled: false
# assignment in conditions are useful sometimes
# TODO: add parentheses for these and remove
Lint/AssignmentInCondition:
Enabled: false
# we output how to use interpolated strings too often
Lint/InterpolationCheck:
Enabled: false
# so many of these in formulae and can't be autocorrected
Lint/ParenthesesAsGroupedExpression:
Enabled: false
# most metrics don't make sense to apply for formulae/taps
Metrics/AbcSize:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
# GitHub diff UI wraps beyond 118 characters (so that's the goal)
Layout/LineLength:
Max: 170
# ignore manpage comments and long single-line strings
IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options :']
# our current conditional style is established
# TODO: enable this when possible
Style/ConditionalAssignment:
Enabled: false
# most of our APIs are internal so don't require docs
Style/Documentation:
Enabled: false
# we want to add this slowly and manually
# TODO: add to more files
Style/FrozenStringLiteralComment:
Enabled: false
# so many of these in formulae and can't be autocorrected
Style/GuardClause:
Enabled: false
# depends_on a: :b looks weird in formulae.
Style/HashSyntax:
EnforcedStyle: hash_rockets
Exclude:
- '**/cmd/*.rb'
# ruby style guide favorite
Style/StringLiterals:
EnforcedStyle: double_quotes
# consistency with above
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
# make things a bit easier to read
Style/TernaryParentheses:
EnforcedStyle: require_parentheses_when_complex
# messes with existing plist/caveats style
Style/TrailingBodyOnMethodDefinition:
Enabled: false
# a bit confusing to non-Rubyists but useful for longer arrays
Style/WordArray:
MinSize: 4
Style/HashEachMethods:
Enabled: true
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true