scinote-web/.rubocop.yml

500 lines
8.6 KiB
YAML
Raw Normal View History

2019-09-17 19:31:56 +08:00
require:
- rubocop-performance
- rubocop-rails
2016-08-23 20:01:08 +08:00
AllCops:
Exclude:
- "vendor/**/*"
- "db/schema.rb"
2021-06-30 19:12:19 +08:00
- "spec/**/*"
2020-09-16 20:13:54 +08:00
NewCops: enable
2016-08-23 20:01:08 +08:00
UseCache: false
TargetRubyVersion: 3.2
2016-08-23 20:01:08 +08:00
##################### Style ####################################
Layout/AccessModifierIndentation:
2016-08-23 20:01:08 +08:00
EnforcedStyle: indent
Layout/HashAlignment:
2016-08-23 20:01:08 +08:00
EnforcedHashRocketStyle: key
EnforcedColonStyle: key
EnforcedLastArgumentHashStyle: ignore_implicit
Layout/ParameterAlignment:
2016-08-23 20:01:08 +08:00
EnforcedStyle: with_first_parameter
Style/AndOr:
EnforcedStyle: conditionals
Style/BarePercentLiterals:
EnforcedStyle: bare_percent
Style/BlockDelimiters:
EnforcedStyle: line_count_based
Layout/CaseIndentation:
EnforcedStyle: case
2016-08-23 20:01:08 +08:00
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:
2016-08-23 20:01:08 +08:00
EnforcedStyle: leading
Style/EmptyElse:
EnforcedStyle: both
Layout/EmptyLineBetweenDefs:
2016-08-23 20:01:08 +08:00
AllowAdjacentOneLineDefs: false
Layout/EmptyLinesAroundBlockBody:
2016-08-23 20:01:08 +08:00
EnforcedStyle: no_empty_lines
Layout/EmptyLinesAroundClassBody:
2016-08-23 20:01:08 +08:00
EnforcedStyle: no_empty_lines
Layout/EmptyLinesAroundModuleBody:
2016-08-23 20:01:08 +08:00
EnforcedStyle: no_empty_lines
Layout/ExtraSpacing:
2016-08-23 20:01:08 +08:00
AllowForAlignment: true
ForceEqualSignAlignment: false
Naming/FileName:
2016-08-23 20:01:08 +08:00
Enabled: false
Exclude: []
2019-12-23 21:34:11 +08:00
Layout/FirstArgumentIndentation:
EnforcedStyle: consistent
2016-08-23 20:01:08 +08:00
Style/For:
EnforcedStyle: each
Style/FormatString:
EnforcedStyle: format
Style/FrozenStringLiteralComment:
EnforcedStyle: always
2016-08-23 20:01:08 +08:00
Style/GuardClause:
Enabled: false
MinBodyLength: 1
Style/HashSyntax:
EnforcedStyle: ruby19
EnforcedShorthandSyntax: never
2016-08-23 20:01:08 +08:00
Style/IfUnlessModifier:
Enabled: true
Layout/IndentationConsistency:
2016-08-23 20:01:08 +08:00
EnforcedStyle: normal
Layout/IndentationWidth:
2016-08-23 20:01:08 +08:00
Width: 2
Layout/FirstArrayElementIndentation:
2016-08-23 20:01:08 +08:00
EnforcedStyle: special_inside_parentheses
Layout/FirstHashElementIndentation:
2016-08-23 20:01:08 +08:00
EnforcedStyle: special_inside_parentheses
Style/Next:
EnforcedStyle: skip_modifier_ifs
Style/NonNilCheck:
IncludeSemanticChanges: false
Style/MethodDefParentheses:
EnforcedStyle: require_parentheses
Naming/MethodName:
2016-08-23 20:01:08 +08:00
EnforcedStyle: snake_case
Layout/MultilineArrayBraceLayout:
2016-08-23 20:01:08 +08:00
EnforcedStyle: symmetrical
Layout/MultilineAssignmentLayout:
2016-08-23 20:01:08 +08:00
SupportedTypes:
- block
- case
- class
- if
- kwbegin
- module
EnforcedStyle: new_line
Layout/MultilineHashBraceLayout:
2016-08-23 20:01:08 +08:00
EnforcedStyle: symmetrical
Layout/MultilineMethodCallBraceLayout:
2016-08-23 20:01:08 +08:00
EnforcedStyle: symmetrical
Layout/MultilineMethodCallIndentation:
2016-08-23 20:01:08 +08:00
EnforcedStyle: aligned
Layout/MultilineMethodDefinitionBraceLayout:
2016-08-23 20:01:08 +08:00
EnforcedStyle: symmetrical
Layout/MultilineOperationIndentation:
2016-08-23 20:01:08 +08:00
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:
2016-08-23 20:01:08 +08:00
Description: Check the names of predicate methods.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
Enabled: true
NamePrefix:
- is_
- has_
- have_
ForbiddenPrefixes:
2016-08-23 20:01:08 +08:00
- is_
AllowedMethods:
2016-08-23 20:01:08 +08:00
- 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:
2016-08-23 20:01:08 +08:00
AllowForAlignment: true
Style/StringLiterals:
Enabled: true
EnforcedStyle: single_quotes
ConsistentQuotesInMultiline: true
Style/StringLiteralsInInterpolation:
EnforcedStyle: single_quotes
Style/StringMethods:
PreferredMethods:
intern: to_sym
Layout/SpaceAroundBlockParameters:
2016-08-23 20:01:08 +08:00
EnforcedStyleInsidePipes: no_space
Layout/SpaceAroundEqualsInParameterDefault:
2016-08-23 20:01:08 +08:00
EnforcedStyle: space
Layout/SpaceAroundOperators:
2016-08-23 20:01:08 +08:00
AllowForAlignment: true
Layout/SpaceBeforeBlockBraces:
2016-08-23 20:01:08 +08:00
EnforcedStyle: space
Layout/SpaceInsideBlockBraces:
2016-08-23 20:01:08 +08:00
EnforcedStyle: space
EnforcedStyleForEmptyBraces: no_space
SpaceBeforeBlockParameters: true
Layout/SpaceInsideHashLiteralBraces:
2016-08-23 20:01:08 +08:00
EnforcedStyle: space
EnforcedStyleForEmptyBraces: no_space
Layout/SpaceInsideStringInterpolation:
2016-08-23 20:01:08 +08:00
EnforcedStyle: no_space
Style/SymbolArray:
EnforcedStyle: percent
Style/SymbolProc:
AllowedMethods:
2016-08-23 20:01:08 +08:00
- respond_to
- define_method
Style/TernaryParentheses:
EnforcedStyle: require_no_parentheses
AllowSafeAssignment: true
Layout/TrailingEmptyLines:
2016-08-23 20:01:08 +08:00
EnforcedStyle: final_newline
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: no_comma
2018-06-20 16:51:31 +08:00
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: no_comma
Style/TrailingCommaInHashLiteral:
2016-08-23 20:01:08 +08:00
EnforcedStyleForMultiline: no_comma
Naming/VariableName:
2016-08-23 20:01:08 +08:00
EnforcedStyle: snake_case
Naming/VariableNumber:
2016-08-23 20:01:08 +08:00
EnforcedStyle: normalcase
Style/WordArray:
EnforcedStyle: percent
MinSize: 0
Style/InlineComment:
Enabled: false
Naming/AccessorMethodName:
2016-08-23 20:01:08 +08:00
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
EnforcedStyle: module_function
2016-08-23 20:01:08 +08:00
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/BlockLength:
AllowedMethods: ['describe', 'context']
2016-08-23 20:01:08 +08:00
Metrics/ClassLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
##################### Layout ###################################
2016-08-23 20:01:08 +08:00
2018-06-20 16:51:31 +08:00
Layout/BlockAlignment:
EnforcedStyleAlignWith: either
2016-08-23 20:01:08 +08:00
2018-06-20 16:51:31 +08:00
Layout/EndAlignment:
EnforcedStyleAlignWith: keyword
2016-08-23 20:01:08 +08:00
2018-06-20 16:51:31 +08:00
Layout/DefEndAlignment:
EnforcedStyleAlignWith: start_of_line
2016-08-23 20:01:08 +08:00
2019-12-23 21:34:11 +08:00
Layout/LineLength:
Max: 120
AllowHeredoc: true
AllowURI: true
URISchemes:
- http
- https
##################### Lint #####################################
Lint/AssignmentInCondition:
AllowSafeAssignment: true
Lint/DuplicateMethods:
Enabled: false
2016-08-23 20:01:08 +08:00
Lint/UnusedBlockArgument:
IgnoreEmptyBlocks: true
AllowUnusedKeywordArguments: false
Lint/UnusedMethodArgument:
AllowUnusedKeywordArguments: false
IgnoreEmptyMethods: true
Lint/EachWithObjectArgument:
Enabled: true
Lint/SuppressedException:
2016-08-23 20:01:08 +08:00
Enabled: false
Lint/LiteralAsCondition:
2016-08-23 20:01:08 +08:00
Enabled: true
Lint/EmptyInterpolation:
Enabled: false
2016-08-23 20:01:08 +08:00
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/SkipsModelValidations:
Exclude:
- spec/**/*_spec.rb
- spec/factories/*.rb
2016-08-23 20:01:08 +08:00
Rails/TimeZone:
EnforcedStyle: flexible
Rails/UniqBeforePluck:
EnforcedStyle: conservative
2016-08-23 20:01:08 +08:00
Rails/Validation:
Include:
- app/models/**/*.rb
##################### Performance ##############################
Performance/RedundantMerge:
Enabled: true