Last active
September 2, 2020 19:40
-
-
Save yosukehasumi/1c884bcb4ac5154356c477dcdfbcccda to your computer and use it in GitHub Desktop.
Animiki/.rubocop.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
require: | |
- rubocop-performance | |
- rubocop-rails | |
Style/Documentation: | |
Enabled: false | |
Layout/EmptyLinesAroundAttributeAccessor: | |
Enabled: true | |
Layout/SpaceAroundMethodCallOperator: | |
Enabled: true | |
Lint/BinaryOperatorWithIdenticalOperands: | |
Enabled: true | |
Lint/DeprecatedOpenSSLConstant: | |
Enabled: true | |
Lint/DuplicateElsifCondition: | |
Enabled: true | |
Lint/DuplicateRescueException: | |
Enabled: true | |
Lint/EmptyConditionalBody: | |
Enabled: true | |
Lint/FloatComparison: | |
Enabled: true | |
Lint/MissingSuper: | |
Enabled: true | |
Lint/MixedRegexpCaptureTypes: | |
Enabled: true | |
Lint/OutOfRangeRegexpRef: | |
Enabled: true | |
Lint/RaiseException: | |
Enabled: true | |
Lint/SelfAssignment: | |
Enabled: true | |
Lint/StructNewOverride: | |
Enabled: true | |
Lint/TopLevelReturnWithArgument: | |
Enabled: true | |
Lint/UnreachableLoop: | |
Enabled: true | |
Style/AccessorGrouping: | |
Enabled: true | |
Style/ArrayCoercion: | |
Enabled: true | |
Style/BisectedAttrAccessor: | |
Enabled: true | |
Style/CaseLikeIf: | |
Enabled: true | |
Style/ExplicitBlockArgument: | |
Enabled: true | |
Style/ExponentialNotation: | |
Enabled: true | |
Style/GlobalStdStream: | |
Enabled: true | |
Style/HashAsLastArrayItem: | |
Enabled: true | |
Style/HashEachMethods: | |
Enabled: true | |
Style/HashLikeCase: | |
Enabled: true | |
Style/HashTransformKeys: | |
Enabled: true | |
Style/HashTransformValues: | |
Enabled: true | |
Style/OptionalBooleanParameter: | |
Enabled: true | |
Style/RedundantAssignment: | |
Enabled: true | |
Style/RedundantFetchBlock: | |
Enabled: true | |
Style/RedundantFileExtensionInRequire: | |
Enabled: true | |
Style/RedundantRegexpCharacterClass: | |
Enabled: true | |
Style/RedundantRegexpEscape: | |
Enabled: true | |
Style/SingleArgumentDig: | |
Enabled: true | |
Style/SlicingWithRange: | |
Enabled: true | |
Style/StringConcatenation: | |
Enabled: true | |
Performance/AncestorsInclude: | |
Enabled: true | |
Performance/BigDecimalWithNumericArgument: | |
Enabled: true | |
Performance/RedundantSortBlock: | |
Enabled: true | |
Performance/RedundantStringChars: | |
Enabled: true | |
Performance/ReverseFirst: | |
Enabled: true | |
Performance/SortReverse: | |
Enabled: true | |
Performance/Squeeze: | |
Enabled: true | |
Performance/StringInclude: | |
Enabled: true | |
Rails/ActiveRecordCallbacksOrder: | |
Enabled: true | |
Rails/FindById: | |
Enabled: true | |
Rails/Inquiry: | |
Enabled: true | |
Rails/MailerName: | |
Enabled: true | |
Rails/MatchRoute: | |
Enabled: true | |
Rails/NegateInclude: | |
Enabled: true | |
Rails/Pluck: | |
Enabled: true | |
Rails/PluckInWhere: | |
Enabled: true | |
Rails/RenderInline: | |
Enabled: true | |
Rails/RenderPlainText: | |
Enabled: true | |
Rails/ShortI18n: | |
Enabled: true | |
Rails/WhereExists: | |
Enabled: true | |
--- | |
require: | |
- rubocop-performance | |
- rubocop-rails | |
AllCops: | |
TargetRubyVersion: 2.4 | |
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop | |
# to ignore them, so only the ones explicitly set in this file are enabled. | |
DisabledByDefault: true | |
Exclude: | |
- 'bin/**' | |
- '**/templates/**/*' | |
- '**/vendor/**/*' | |
- 'actionpack/lib/action_dispatch/journey/parser.rb' | |
- 'railties/test/fixtures/tmp/**/*' | |
- 'actionmailbox/test/dummy/**/*' | |
- 'actiontext/test/dummy/**/*' | |
- '**/node_modules/**/*' | |
- '**/test/**/*' | |
- '**/db/**/*' | |
Layout/AccessModifierIndentation: | |
Description: Check indentation of private/protected visibility modifiers. | |
StyleGuide: '#indent-public-private-protected' | |
Enabled: true | |
VersionAdded: '0.49' | |
# ClearCove | |
EnforcedStyle: outdent | |
SupportedStyles: | |
- outdent | |
- indent | |
# By default, the indentation width from Layout/IndentationWidth is used | |
# But it can be overridden by setting this parameter | |
IndentationWidth: ~ | |
# Method definitions after `private` or `protected` isolated calls need one | |
# extra level of indentation. | |
Layout/IndentationConsistency: | |
Enabled: false | |
Style/Lambda: | |
Description: 'Use the new lambda literal syntax for single-line blocks.' | |
StyleGuide: '#lambda-multi-line' | |
Enabled: true | |
VersionAdded: '0.9' | |
VersionChanged: '0.40' | |
# ClearCove | |
EnforcedStyle: literal | |
SupportedStyles: | |
- line_count_dependent | |
- lambda | |
- literal | |
Layout/LineLength: | |
Description: 'Limit lines to 80 characters.' | |
StyleGuide: '#80-character-limits' | |
Enabled: true | |
VersionAdded: '0.25' | |
VersionChanged: '0.46' | |
# ClearCove | |
Max: 120 | |
# To make it possible to copy or click on URIs in the code, we allow lines | |
# containing a URI to be longer than Max. | |
AllowHeredoc: true | |
AllowURI: true | |
URISchemes: | |
- http | |
- https | |
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop | |
# directives like '# rubocop: enable ...' when calculating a line's length. | |
IgnoreCopDirectives: false | |
# The IgnoredPatterns option is a list of !ruby/regexp and/or string | |
# elements. Strings will be converted to Regexp objects. A line that matches | |
# any regular expression listed in this option will be ignored by LineLength. | |
IgnoredPatterns: [] | |
Layout/MultilineMethodCallIndentation: | |
Description: >- | |
Checks indentation of method calls with the dot operator | |
that span more than one line. | |
Enabled: true | |
VersionAdded: '0.49' | |
# ClearCove | |
EnforcedStyle: indented_relative_to_receiver | |
SupportedStyles: | |
- aligned | |
- indented | |
- indented_relative_to_receiver | |
# By default, the indentation width from Layout/IndentationWidth is used | |
# But it can be overridden by setting this parameter | |
IndentationWidth: ~ | |
Metrics/AbcSize: | |
Description: >- | |
A calculated magnitude based on number of assignments, | |
branches, and conditions. | |
Enabled: false | |
Metrics/BlockLength: | |
Description: 'Avoid long blocks with many lines.' | |
Enabled: false | |
Metrics/ClassLength: | |
Description: 'Avoid classes longer than 100 lines of code.' | |
Enabled: false | |
Metrics/CyclomaticComplexity: | |
Description: > | |
This cop checks that the cyclomatic complexity of methods is not higher | |
than the configured maximum. | |
Enabled: false | |
Metrics/MethodLength: | |
Description: 'Avoid methods longer than 10 lines of code.' | |
Enabled: false | |
Metrics/ModuleLength: | |
Description: 'Avoid modules longer than 100 lines of code.' | |
Enabled: false | |
Naming/PredicateName: | |
Description: 'Check the names of predicate methods.' | |
# ClearCove: We allow names like "has_admin_role?". | |
Enabled: false | |
Style/StringLiterals: | |
Description: 'Checks if uses of quotes match the configured preference.' | |
StyleGuide: '#consistent-string-literals' | |
Enabled: true | |
VersionAdded: '0.9' | |
VersionChanged: '0.36' | |
# ClearCove | |
EnforcedStyle: single_quotes | |
SupportedStyles: | |
- single_quotes | |
- double_quotes | |
# If `true`, strings which span multiple lines using `\` for continuation must | |
# use the same type of quotes on each line. | |
# ClearCove | |
ConsistentQuotesInMultiline: true | |
Style/NegatedIf: | |
Description: >- | |
Favor unless over if for negative conditions | |
(or control flow or). | |
Enabled: false | |
Layout/ExtraSpacing: | |
Description: 'Do not use unnecessary spacing.' | |
Enabled: false | |
Style/TrailingCommaInArguments: | |
Description: 'Checks for trailing comma in argument lists.' | |
StyleGuide: '#no-trailing-params-comma' | |
Enabled: true | |
VersionAdded: '0.36' | |
# If `comma`, the cop requires a comma after the last argument, but only for | |
# parenthesized method calls where each argument is on its own line. | |
# If `consistent_comma`, the cop requires a comma after the last argument, | |
# for all parenthesized method calls with arguments. | |
# ClearCove | |
EnforcedStyleForMultiline: no_comma | |
SupportedStylesForMultiline: | |
- comma | |
- consistent_comma | |
- no_comma | |
Style/TrailingCommaInArrayLiteral: | |
Description: 'Checks for trailing comma in array literals.' | |
StyleGuide: '#no-trailing-array-commas' | |
Enabled: true | |
VersionAdded: '0.53' | |
# but only when each item is on its own line. | |
# If `consistent_comma`, the cop requires a comma after the last item of all | |
# non-empty array literals. | |
# ClearCove | |
EnforcedStyleForMultiline: no_comma | |
SupportedStylesForMultiline: | |
- comma | |
- consistent_comma | |
- no_comma | |
Style/TrailingCommaInHashLiteral: | |
Description: 'Checks for trailing comma in hash literals.' | |
Enabled: true | |
# If `comma`, the cop requires a comma after the last item in a hash, | |
# but only when each item is on its own line. | |
# If `consistent_comma`, the cop requires a comma after the last item of all | |
# non-empty hash literals. | |
# ClearCove | |
EnforcedStyleForMultiline: no_comma | |
SupportedStylesForMultiline: | |
- comma | |
- consistent_comma | |
- no_comma | |
VersionAdded: '0.53' | |
Style/BlockDelimiters: | |
Description: >- | |
Avoid using {...} for multi-line blocks (multiline chaining is | |
always ugly). | |
Prefer {...} over do...end for single-line blocks. | |
StyleGuide: '#single-line-blocks' | |
# ClearCove | |
Enabled: false | |
VersionAdded: '0.30' | |
VersionChanged: '0.35' | |
# ClearCove | |
EnforcedStyle: semantic | |
SupportedStyles: | |
# The `line_count_based` style enforces braces around single line blocks and | |
# do..end around multi-line blocks. | |
- line_count_based | |
# The `semantic` style enforces braces around functional blocks, where the | |
# primary purpose of the block is to return a value and do..end for | |
# procedural blocks, where the primary purpose of the block is its | |
# side-effects. | |
# | |
# This looks at the usage of a block's method to determine its type (e.g. is | |
# the result of a `map` assigned to a variable or passed to another | |
# method) but exceptions are permitted in the `ProceduralMethods`, | |
# `FunctionalMethods` and `IgnoredMethods` sections below. | |
- semantic | |
# The `braces_for_chaining` style enforces braces around single line blocks | |
# and do..end around multi-line blocks, except for multi-line blocks whose | |
# return value is being chained with another method (in which case braces | |
# are enforced). | |
- braces_for_chaining | |
ProceduralMethods: | |
# Methods that are known to be procedural in nature but look functional from | |
# their usage, e.g. | |
# | |
# time = Benchmark.realtime do | |
# foo.bar | |
# end | |
# | |
# Here, the return value of the block is discarded but the return value of | |
# `Benchmark.realtime` is used. | |
- benchmark | |
- bm | |
- bmbm | |
- create | |
- each_with_object | |
- measure | |
- new | |
- realtime | |
- tap | |
- with_object | |
FunctionalMethods: | |
# Methods that are known to be functional in nature but look procedural from | |
# their usage, e.g. | |
# | |
# let(:foo) { Foo.new } | |
# | |
# Here, the return value of `Foo.new` is used to define a `foo` helper but | |
# doesn't appear to be used from the return value of `let`. | |
- let | |
- let! | |
- subject | |
- watch | |
IgnoredMethods: | |
# Methods that can be either procedural or functional and cannot be | |
# categorised from their usage alone, e.g. | |
# | |
# foo = lambda do |x| | |
# puts "Hello, #{x}" | |
# end | |
# | |
# foo = lambda do |x| | |
# x * 100 | |
# end | |
# | |
# Here, it is impossible to tell from the return value of `lambda` whether | |
# the inner block's return value is significant. | |
- lambda | |
- proc | |
- it | |
Style/SymbolArray: | |
Description: 'Use %i or %I for arrays of symbols.' | |
StyleGuide: '#percent-i' | |
Enabled: true | |
VersionAdded: '0.9' | |
VersionChanged: '0.49' | |
# ClearCove | |
EnforcedStyle: brackets | |
MinSize: 2 | |
SupportedStyles: | |
- percent | |
- brackets | |
Layout/EmptyLinesAroundClassBody: | |
Description: 'Keeps track of empty lines around class bodies.' | |
StyleGuide: '#empty-lines-around-bodies' | |
Enabled: true | |
VersionAdded: '0.49' | |
VersionChanged: '0.53' | |
# ClearCove | |
EnforcedStyle: empty_lines_except_namespace | |
SupportedStyles: | |
- empty_lines | |
- empty_lines_except_namespace | |
- empty_lines_special | |
- no_empty_lines | |
- beginning_only | |
- ending_only | |
Layout/EmptyLinesAroundModuleBody: | |
Description: 'Keeps track of empty lines around module bodies.' | |
StyleGuide: '#empty-lines-around-bodies' | |
Enabled: true | |
VersionAdded: '0.49' | |
# ClearCove | |
EnforcedStyle: empty_lines_except_namespace | |
SupportedStyles: | |
- empty_lines | |
- empty_lines_except_namespace | |
- empty_lines_special | |
- no_empty_lines | |
Layout/ClassStructure: | |
Description: 'Enforces a configured order of definitions within a class body.' | |
StyleGuide: > | |
https://github.com/rubocop-hq/ruby-style-guide#consistent-classes | |
# ClearCove | |
Enabled: true | |
VersionAdded: '0.52' | |
Categories: | |
module_inclusion: | |
- include | |
- prepend | |
- extend | |
ExpectedOrder: | |
- module_inclusion | |
- constants | |
- public_class_methods | |
- initializer | |
- public_methods | |
- protected_methods | |
- private_methods | |
Style/YodaCondition: | |
Description: 'Forbid or enforce yoda conditions.' | |
Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions' | |
Enabled: true | |
# ClearCove | |
EnforcedStyle: require_for_equality_operators_only | |
SupportedStyles: | |
# check all comparison operators | |
- forbid_for_all_comparison_operators | |
# check only equality operators: `!=` and `==` | |
- forbid_for_equality_operators_only | |
# enforce yoda for all comparison operators | |
- require_for_all_comparison_operators | |
# enforce yoda only for equality operators: `!=` and `==` | |
- require_for_equality_operators_only | |
VersionAdded: '0.49' | |
VersionChanged: '0.63' | |
Style/FrozenStringLiteralComment: | |
Description: >- | |
Add the frozen_string_literal comment to the top of files | |
to help transition from Ruby 2.3.0 to Ruby 3.0. | |
Enabled: true | |
VersionAdded: '0.36' | |
VersionChanged: '0.47' | |
# ClearCove | |
EnforcedStyle: never | |
SupportedStyles: | |
# `when_needed` will add the frozen string literal comment to files | |
# only when the `TargetRubyVersion` is set to 2.3+. | |
- when_needed | |
# `always` will always add the frozen string literal comment to a file | |
# regardless of the Ruby version or if `freeze` or `<<` are called on a | |
# string literal. If you run code against multiple versions of Ruby, it is | |
# possible that this will create errors in Ruby 2.3.0+. | |
- always | |
# `never` will enforce that the frozen string literal comment does not | |
# exist in a file. | |
- never | |
Layout/EndAlignment: | |
Description: 'Align ends correctly.' | |
Enabled: true | |
VersionAdded: '0.53' | |
# The value `keyword` means that `end` should be aligned with the matching | |
# keyword (`if`, `while`, etc.). | |
# The value `variable` means that in assignments, `end` should be aligned | |
# with the start of the variable on the left hand side of `=`. In all other | |
# situations, `end` should still be aligned with the keyword. | |
# The value `start_of_line` means that `end` should be aligned with the start | |
# of the line which the matching keyword appears on. | |
EnforcedStyleAlignWith: keyword | |
SupportedStylesAlignWith: | |
- keyword | |
- variable | |
- start_of_line | |
# ClearCove | |
AutoCorrect: true | |
Severity: warning | |
# Start AKII settings. Where using ClearCove, state it clearly in COP | |
Performance: | |
Exclude: | |
- '**/test/**/*' | |
Rails: | |
Enabled: true | |
# Prefer assert_not over assert ! | |
Rails/AssertNot: | |
Include: | |
- '**/test/**/*' | |
# Prefer assert_not_x over refute_x | |
Rails/RefuteMethods: | |
Include: | |
- '**/test/**/*' | |
# Prefer &&/|| over and/or. | |
Style/AndOr: | |
Enabled: true | |
# Align `when` with `case`. | |
Layout/CaseIndentation: | |
Enabled: true | |
# Align comments with method definitions. | |
Layout/CommentIndentation: | |
Enabled: true | |
Layout/ElseAlignment: | |
Enabled: true | |
Layout/EmptyLineAfterMagicComment: | |
Enabled: true | |
Layout/EmptyLinesAroundBlockBody: | |
Enabled: false | |
Layout/FirstArgumentIndentation: | |
Enabled: true | |
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. | |
Style/HashSyntax: | |
Enabled: true | |
# Detect hard tabs, no hard tabs. | |
Layout/IndentationStyle: | |
Enabled: true | |
# Two spaces, no tabs (for indentation). | |
Layout/IndentationWidth: | |
Enabled: true | |
Layout/LeadingCommentSpace: | |
Enabled: true | |
Layout/SpaceAfterColon: | |
Enabled: true | |
Layout/SpaceAfterComma: | |
Enabled: true | |
Layout/SpaceAfterSemicolon: | |
Enabled: true | |
Layout/SpaceAroundEqualsInParameterDefault: | |
Enabled: true | |
Layout/SpaceAroundKeyword: | |
Enabled: true | |
Layout/SpaceAroundOperators: | |
Enabled: true | |
Layout/SpaceBeforeComma: | |
Enabled: true | |
Layout/SpaceBeforeComment: | |
Enabled: true | |
Layout/SpaceBeforeFirstArg: | |
Enabled: true | |
Style/DefWithParentheses: | |
Enabled: true | |
# Defining a method with parameters needs parentheses. | |
Style/MethodDefParentheses: | |
Enabled: true | |
Style/RedundantFreeze: | |
Enabled: true | |
# Use `foo {}` not `foo{}`. | |
Layout/SpaceBeforeBlockBraces: | |
Enabled: true | |
# Use `foo { bar }` not `foo {bar}`. | |
Layout/SpaceInsideBlockBraces: | |
Enabled: true | |
EnforcedStyleForEmptyBraces: space | |
# Use `{ a: 1 }` not `{a:1}`. | |
Layout/SpaceInsideHashLiteralBraces: | |
Enabled: true | |
Layout/SpaceInsideParens: | |
Enabled: true | |
# Blank lines should not have any spaces. | |
Layout/TrailingEmptyLines: | |
Enabled: true | |
# No trailing whitespace. | |
Layout/TrailingWhitespace: | |
Enabled: true | |
# Use quotes for string literals when they are enough. | |
Style/RedundantPercentQ: | |
Enabled: true | |
Lint/AmbiguousOperator: | |
Enabled: true | |
Lint/AmbiguousRegexpLiteral: | |
Enabled: true | |
Lint/ErbNewArguments: | |
Enabled: true | |
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. | |
Lint/RequireParentheses: | |
Enabled: true | |
Lint/ShadowingOuterLocalVariable: | |
Enabled: true | |
Lint/RedundantStringCoercion: | |
Enabled: true | |
Lint/UriEscapeUnescape: | |
Enabled: true | |
Lint/UselessAssignment: | |
Enabled: true | |
Lint/DeprecatedClassMethods: | |
Enabled: true | |
Style/ParenthesesAroundCondition: | |
Enabled: true | |
Style/RedundantBegin: | |
Enabled: true | |
Style/RedundantReturn: | |
Enabled: true | |
AllowMultipleReturnValues: true | |
Style/Semicolon: | |
Enabled: true | |
AllowAsExpressionSeparator: true | |
# Prefer Foo.method over Foo::method | |
Style/ColonMethodCall: | |
Enabled: true | |
Style/TrivialAccessors: | |
Enabled: true | |
Performance/FlatMap: | |
Enabled: true | |
Performance/RedundantMerge: | |
Enabled: true | |
Performance/StartWith: | |
Enabled: true | |
Performance/EndWith: | |
Enabled: true | |
Performance/RegexpMatch: | |
Enabled: true | |
Performance/ReverseEach: | |
Enabled: true | |
Performance/UnfreezeString: | |
Enabled: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment