mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-31 04:32:06 +08:00
501 lines
8.7 KiB
YAML
501 lines
8.7 KiB
YAML
require:
|
|
- rubocop-performance
|
|
- rubocop-rails
|
|
|
|
AllCops:
|
|
Exclude:
|
|
- "vendor/**/*"
|
|
- "db/schema.rb"
|
|
- "spec/**/*"
|
|
NewCops: enable
|
|
UseCache: false
|
|
TargetRubyVersion: 3.1
|
|
|
|
##################### Style ####################################
|
|
|
|
Layout/AccessModifierIndentation:
|
|
EnforcedStyle: indent
|
|
|
|
Layout/HashAlignment:
|
|
EnforcedHashRocketStyle: key
|
|
EnforcedColonStyle: key
|
|
EnforcedLastArgumentHashStyle: ignore_implicit
|
|
|
|
Layout/ParameterAlignment:
|
|
EnforcedStyle: with_first_parameter
|
|
|
|
Style/AndOr:
|
|
EnforcedStyle: conditionals
|
|
|
|
Style/BarePercentLiterals:
|
|
EnforcedStyle: bare_percent
|
|
|
|
Style/BlockDelimiters:
|
|
EnforcedStyle: line_count_based
|
|
|
|
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/FirstArgumentIndentation:
|
|
EnforcedStyle: consistent
|
|
|
|
Style/For:
|
|
EnforcedStyle: each
|
|
|
|
Style/FormatString:
|
|
EnforcedStyle: format
|
|
|
|
Style/FrozenStringLiteralComment:
|
|
EnforcedStyle: always
|
|
|
|
Style/GuardClause:
|
|
Enabled: false
|
|
MinBodyLength: 1
|
|
|
|
Style/HashSyntax:
|
|
EnforcedShorthandSyntax: never
|
|
|
|
Style/IfUnlessModifier:
|
|
Enabled: true
|
|
|
|
Layout/IndentationConsistency:
|
|
EnforcedStyle: normal
|
|
|
|
Layout/IndentationWidth:
|
|
Width: 2
|
|
|
|
Layout/FirstArrayElementIndentation:
|
|
EnforcedStyle: special_inside_parentheses
|
|
|
|
Layout/FirstHashElementIndentation:
|
|
EnforcedStyle: special_inside_parentheses
|
|
|
|
Style/Next:
|
|
EnforcedStyle: skip_modifier_ifs
|
|
|
|
Style/NonNilCheck:
|
|
IncludeSemanticChanges: false
|
|
|
|
Style/MethodDefParentheses:
|
|
EnforcedStyle: require_parentheses
|
|
|
|
Naming/MethodName:
|
|
EnforcedStyle: snake_case
|
|
|
|
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_
|
|
ForbiddenPrefixes:
|
|
- is_
|
|
AllowedMethods:
|
|
- 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:
|
|
AllowedMethods:
|
|
- respond_to
|
|
- define_method
|
|
|
|
Style/TernaryParentheses:
|
|
EnforcedStyle: require_no_parentheses
|
|
AllowSafeAssignment: true
|
|
|
|
Layout/TrailingEmptyLines:
|
|
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
|
|
|
|
Naming/BlockForwarding:
|
|
EnforcedStyle: explicit
|
|
|
|
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
|
|
EnforcedStyle: module_function
|
|
|
|
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']
|
|
|
|
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 ###################################
|
|
|
|
Layout/BlockAlignment:
|
|
EnforcedStyleAlignWith: either
|
|
|
|
Layout/EndAlignment:
|
|
EnforcedStyleAlignWith: keyword
|
|
|
|
Layout/DefEndAlignment:
|
|
EnforcedStyleAlignWith: start_of_line
|
|
|
|
Layout/LineLength:
|
|
Max: 120
|
|
AllowHeredoc: true
|
|
AllowURI: true
|
|
URISchemes:
|
|
- http
|
|
- https
|
|
|
|
##################### Lint #####################################
|
|
|
|
Lint/AssignmentInCondition:
|
|
AllowSafeAssignment: true
|
|
|
|
Lint/DuplicateMethods:
|
|
Enabled: false
|
|
|
|
Lint/UnusedBlockArgument:
|
|
IgnoreEmptyBlocks: true
|
|
AllowUnusedKeywordArguments: false
|
|
|
|
Lint/UnusedMethodArgument:
|
|
AllowUnusedKeywordArguments: false
|
|
IgnoreEmptyMethods: true
|
|
|
|
Lint/EachWithObjectArgument:
|
|
Enabled: true
|
|
|
|
Lint/SuppressedException:
|
|
Enabled: false
|
|
|
|
Lint/LiteralAsCondition:
|
|
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/SkipsModelValidations:
|
|
Exclude:
|
|
- spec/**/*_spec.rb
|
|
- spec/factories/*.rb
|
|
|
|
Rails/TimeZone:
|
|
EnforcedStyle: flexible
|
|
|
|
Rails/UniqBeforePluck:
|
|
EnforcedStyle: conservative
|
|
|
|
Rails/Validation:
|
|
Include:
|
|
- app/models/**/*.rb
|
|
|
|
##################### Performance ##############################
|
|
|
|
Performance/RedundantMerge:
|
|
Enabled: true
|