-
Notifications
You must be signed in to change notification settings - Fork 2
/
.rubocop.yml
103 lines (90 loc) · 2.41 KB
/
.rubocop.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
############################
## General Rubocop Config ##
############################
require:
- rubocop-rspec
- rubocop-performance
AllCops:
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: 3.0.0
###########################
## Custom Rubocop Config ##
###########################
############
## Layout ##
############
Layout/LineLength:
AllowedPatterns: ['it { is_expected.']
Max: 80
# Variable assignment can be indented weirdly, so align to the ending statement
# instead
Layout/CaseIndentation:
EnforcedStyle: end
# Lines can get stupidly long if we indent it to the other params/args
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
# Force prettier hash alignment
Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
# It can be unclear if a line is truly ended unless the dot is on the method
# receiver
Layout/DotPosition:
EnforcedStyle: trailing
# Allow extra spaces when aligning to other operators...
# (doesn't seem to work all the time though)
Layout/SpaceAroundOperators:
AllowForAlignment: true
############
## Naming ##
############
# Following bundler naming conventions
Naming/FileName:
Exclude:
- 'sorcery-core/lib/sorcery-core.rb'
- 'sorcery-jwt/lib/sorcery-jwt.rb'
- 'sorcery-mfa/lib/sorcery-mfa.rb'
- 'sorcery-oauth/lib/sorcery-oauth.rb'
###########
## RSpec ##
###########
RSpec/FilePath:
CustomTransform:
BCrypt: bcrypt
OAuth: oauth
OAuthController: oauth_controller
# Allow 2 expectations for before/after checking
RSpec/MultipleExpectations:
Max: 2
# `should` and `should_not` read nicely
RSpec/ImplicitExpect:
EnforcedStyle: should
RSpec/DescribeClass:
Exclude:
- 'spec/requests/**/*'
- 'spec/system/**/*'
###########
## Style ##
###########
# ¯\_(ツ)_/¯
Style/AsciiComments:
AllowedChars: ['ツ', '¯']
# https://github.com/bbatsov/ruby-style-guide/issues/556
Style/ModuleFunction:
EnforcedStyle: extend_self
# The readability of [:some, :various, :symbols] > %i[some various symbols]
Style/SymbolArray:
EnforcedStyle: brackets
# Very tempted to disable this cop entirely.
Style/FrozenStringLiteralComment:
Exclude:
- 'spec/dummy_app/db/**/*'
#############
## Metrics ##
#############
# TODO: Is there a good way to break up specs without it getting unwieldy?
Metrics/BlockLength:
AllowedMethods: ['describe', 'context']