AllCops:
  Exclude:
    - "vendor/**/*"
    - "db/schema.rb"
  UseCache: false
  TargetRubyVersion: 2.2

##################### Style ####################################

Layout/AccessModifierIndentation:
  EnforcedStyle: indent

Layout/AlignHash:
  EnforcedHashRocketStyle: key
  EnforcedColonStyle: key
  EnforcedLastArgumentHashStyle: ignore_implicit

Layout/AlignParameters:
  EnforcedStyle: with_first_parameter

Style/AndOr:
  EnforcedStyle: conditionals

Style/BarePercentLiterals:
  EnforcedStyle: bare_percent

Style/BlockDelimiters:
  EnforcedStyle: line_count_based

Style/BracesAroundHashParameters:
  EnforcedStyle: no_braces

Layout/CaseIndentation:
  EnforcedStyle: case

Style/ClassAndModuleChildren:
  EnforcedStyle: nested

Style/ClassCheck:
  EnforcedStyle: is_a?

Style/CollectionMethods:
  PreferredMethods:
    collect: map
    collect!: map!
    detect: find
    find_all: select
    reduce: inject

Style/CommandLiteral:
  EnforcedStyle: backticks

Style/DocumentationMethod:
  RequireForNonPublicMethods: false

Layout/DotPosition:
  EnforcedStyle: leading

Style/EmptyElse:
  EnforcedStyle: both

Layout/EmptyLineBetweenDefs:
  AllowAdjacentOneLineDefs: false

Layout/EmptyLinesAroundBlockBody:
  EnforcedStyle: no_empty_lines

Layout/EmptyLinesAroundClassBody:
  EnforcedStyle: no_empty_lines

Layout/EmptyLinesAroundModuleBody:
  EnforcedStyle: no_empty_lines

Layout/ExtraSpacing:
  AllowForAlignment: true
  ForceEqualSignAlignment: false

Naming/FileName:
  Enabled: false
  Exclude: []

Layout/FirstParameterIndentation:
  EnforcedStyle: special_for_inner_method_call_in_parentheses

Style/For:
  EnforcedStyle: each

Style/FormatString:
  EnforcedStyle: format

Style/FrozenStringLiteralComment:
  EnforcedStyle: when_needed

Style/GuardClause:
  Enabled: false
  MinBodyLength: 1

Style/HashSyntax:
  EnforcedStyle: ruby19

Style/IfUnlessModifier:
  Enabled: true
  Metrics/LineLength: 80

Layout/IndentationConsistency:
  EnforcedStyle: normal

Layout/IndentationWidth:
  Width: 2

Layout/IndentArray:
  EnforcedStyle: special_inside_parentheses

Layout/IndentHash:
  EnforcedStyle: special_inside_parentheses

Style/Next:
  EnforcedStyle: skip_modifier_ifs

Style/NonNilCheck:
  IncludeSemanticChanges: false

Style/MethodDefParentheses:
  EnforcedStyle: require_parentheses

Naming/MethodName:
  EnforcedStyle: snake_case

Style/ModuleFunction:
  EnforcedStyle: module_function

Layout/MultilineArrayBraceLayout:
  EnforcedStyle: symmetrical

Layout/MultilineAssignmentLayout:
  SupportedTypes:
    - block
    - case
    - class
    - if
    - kwbegin
    - module
  EnforcedStyle: new_line

Layout/MultilineHashBraceLayout:
  EnforcedStyle: symmetrical

Layout/MultilineMethodCallBraceLayout:
  EnforcedStyle: symmetrical

Layout/MultilineMethodCallIndentation:
  EnforcedStyle: aligned

Layout/MultilineMethodDefinitionBraceLayout:
  EnforcedStyle: symmetrical

Layout/MultilineOperationIndentation:
  EnforcedStyle: aligned

Style/NumericLiterals:
  Enabled: false

Style/NumericLiteralPrefix:
  EnforcedOctalStyle: zero_with_o

Style/OptionHash:
  SuspiciousParamNames:
    - options
    - opts
    - args
    - params
    - parameters

Style/ParenthesesAroundCondition:
  AllowSafeAssignment: true

Style/PercentLiteralDelimiters:
  PreferredDelimiters:
    "%": "()"
    "%i": "()"
    "%q": "()"
    "%Q": "()"
    "%r": "{}"
    "%s": "()"
    "%w": "()"
    "%W": "()"
    "%x": "()"

Style/PercentQLiterals:
  EnforcedStyle: lower_case_q

Naming/PredicateName:
  Description: Check the names of predicate methods.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
  Enabled: true
  NamePrefix:
  - is_
  - has_
  - have_
  NamePrefixBlacklist:
  - is_
  NameWhitelist:
    - is_a?
  Exclude:
  - spec/**/*

Style/RaiseArgs:
  Description: Checks the arguments passed to raise/fail.
  EnforcedStyle: exploded
  SupportedStyles:
  - compact
  - exploded

Style/RedundantReturn:
  AllowMultipleReturnValues: true

Style/RegexpLiteral:
  EnforcedStyle: slashes
  AllowInnerSlashes: false

Style/Semicolon:
  AllowAsExpressionSeparator: true

Style/SignalException:
  Enabled: true
  EnforcedStyle: only_raise

Style/SingleLineBlockParams:
  Enabled: false

Style/SingleLineMethods:
  Enabled: false

Layout/SpaceBeforeFirstArg:
  AllowForAlignment: true

Style/StringLiterals:
  Enabled: true
  EnforcedStyle: single_quotes
  ConsistentQuotesInMultiline: true

Style/StringLiteralsInInterpolation:
  EnforcedStyle: single_quotes

Style/StringMethods:
  PreferredMethods:
    intern: to_sym

Layout/SpaceAroundBlockParameters:
  EnforcedStyleInsidePipes: no_space

Layout/SpaceAroundEqualsInParameterDefault:
  EnforcedStyle: space

Layout/SpaceAroundOperators:
  AllowForAlignment: true

Layout/SpaceBeforeBlockBraces:
  EnforcedStyle: space

Layout/SpaceInsideBlockBraces:
  EnforcedStyle: space
  EnforcedStyleForEmptyBraces: no_space
  SpaceBeforeBlockParameters: true

Layout/SpaceInsideHashLiteralBraces:
  EnforcedStyle: space
  EnforcedStyleForEmptyBraces: no_space

Layout/SpaceInsideStringInterpolation:
  EnforcedStyle: no_space

Style/SymbolArray:
  EnforcedStyle: percent

Style/SymbolProc:
  IgnoredMethods:
    - respond_to
    - define_method

Style/TernaryParentheses:
  EnforcedStyle: require_no_parentheses
  AllowSafeAssignment: true

Layout/TrailingBlankLines:
  EnforcedStyle: final_newline

Style/TrailingCommaInArguments:
  EnforcedStyleForMultiline: no_comma

Style/TrailingCommaInArrayLiteral:
  EnforcedStyleForMultiline: no_comma

Style/TrailingCommaInHashLiteral:
  EnforcedStyleForMultiline: no_comma

Naming/VariableName:
  EnforcedStyle: snake_case

Naming/VariableNumber:
  EnforcedStyle: normalcase

Style/WordArray:
  EnforcedStyle: percent
  MinSize: 0

Style/InlineComment:
  Enabled: false

Naming/AccessorMethodName:
  Enabled: true

Style/Alias:
  Enabled: true

Style/Documentation:
  Enabled: false

Style/DoubleNegation:
  Enabled: true

Style/EachWithObject:
  Enabled: true

Style/EmptyLiteral:
  Enabled: true

Style/ModuleFunction:
  Enabled: true

Style/OneLineConditional:
  Enabled: true

Style/PerlBackrefs:
  Enabled: true

Style/Send:
  Enabled: true

Style/SpecialGlobalVars:
  Enabled: true

Style/VariableInterpolation:
  Enabled: true

Style/WhenThen:
  Enabled: true

##################### Metrics ##################################

Metrics/AbcSize:
  Enabled: false

Metrics/ClassLength:
  Enabled: false

Metrics/ModuleLength:
  Enabled: false

Metrics/CyclomaticComplexity:
  Enabled: false

Metrics/LineLength:
  Max: 80
  AllowHeredoc: true
  AllowURI: true
  URISchemes:
    - http
    - https

Metrics/MethodLength:
  Enabled: false

Metrics/ParameterLists:
  Enabled: false

Metrics/PerceivedComplexity:
  Enabled: false

##################### Lint #####################################

Lint/AssignmentInCondition:
  AllowSafeAssignment: true

Layout/BlockAlignment:
  EnforcedStyleAlignWith: either

Layout/EndAlignment:
  EnforcedStyleAlignWith: keyword

Lint/DuplicateMethods:
  Enabled: false

Layout/DefEndAlignment:
  EnforcedStyleAlignWith: start_of_line

Lint/UnusedBlockArgument:
  IgnoreEmptyBlocks: true
  AllowUnusedKeywordArguments: false

Lint/UnusedMethodArgument:
  AllowUnusedKeywordArguments: false
  IgnoreEmptyMethods: true

Lint/EachWithObjectArgument:
  Enabled: true

Lint/HandleExceptions:
  Enabled: false

Lint/LiteralInCondition:
  Enabled: true

Lint/EmptyInterpolation:
  Enabled: false

Lint/LiteralInInterpolation:
  Enabled: true

##################### Rails ####################################

Rails/ActionFilter:
  EnforcedStyle: action
  Include:
    - app/controllers/**/*.rb

Rails/Date:
  EnforcedStyle: flexible

Rails/Exit:
  Include:
    - app/**/*.rb
    - config/**/*.rb
    - lib/**/*.rb
  Exclude:
    - lib/**/*.rake

Rails/FindBy:
  Include:
    - app/models/**/*.rb

Rails/FindEach:
  Include:
    - app/models/**/*.rb

Rails/HasAndBelongsToMany:
  Include:
    - app/models/**/*.rb

Rails/NotNullColumn:
  Include:
    - db/migrate/*.rb

Rails/Output:
  Include:
    - app/**/*.rb
    - config/**/*.rb
    - db/**/*.rb
    - lib/**/*.rb

Rails/ReadWriteAttribute:
  Include:
    - app/models/**/*.rb

Rails/RequestReferer:
  EnforcedStyle: referer

Rails/SafeNavigation:
  ConvertTry: false

Rails/ScopeArgs:
  Include:
    - app/models/**/*.rb

Rails/TimeZone:
  EnforcedStyle: flexible

Rails/UniqBeforePluck:
  EnforcedStyle: conservative

Rails/Validation:
  Include:
    - app/models/**/*.rb

##################### Performance ##############################

Performance/RedundantMerge:
  Enabled: true
