forked from airbnb/ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rubocop-airbnb.yml
95 lines (78 loc) · 3.38 KB
/
rubocop-airbnb.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
# All of these rules are implemented in this gem.
# They are custom built for use inside Airbnb and address issues that we have experienced in
# testing and production.
Airbnb/ClassOrModuleDeclaredInWrongFile:
Description: Declare a class or module in the file that matches its namespace and name.
Enabled: true
Include:
- 'app/**/*'
- 'lib/**/*'
Airbnb/ConstAssignedInWrongFile:
Description: Assign a const in a file that matches the namespace in which it is scoped.
Enabled: true
Include:
- 'app/**/*'
- 'lib/**/*'
Airbnb/ContinuationSlash:
Description: Slash continuation should be reserved for string continatuion. Many times it is
used to get around other existing rules.
Enabled: true
Airbnb/DefaultScope:
Description: Avoid `default_scope`. Default scopes make it difficult to
refactor data access patterns since the scope becomes part of every query unless
explicitly excluded, even when it is unnecessary or incidental to the desired logic.
Enabled: true
Airbnb/FactoryAttrReferencesClass:
Description: Cop to enforce "attr { CONST }" instead of "attr CONST" in factories,
because the latter forces autoload, which slows down spec startup time and
Zeus reload time after touching a model.
Enabled: true
Airbnb/FactoryClassUseString:
Description: Cop to tell developers to use :class => "MyClass" instead of :class => MyClass,
because the latter slows down reloading zeus.
Enabled: true
Airbnb/MassAssignmentAccessibleModifier:
Description: Do no override and objects mass assignment restrictions.
Enabled: true
Airbnb/ModuleMethodInWrongFile:
Description: Define a module method in the file that defines the module, not a file that
happens to use the module as a namespace.
Enabled: true
Include:
- 'app/**/*'
- 'lib/**/*'
Airbnb/NoTimeout:
Description: Do not use Timeout.timeout. In combination with Rails autoloading,
timeout can cause Segmentation Faults in version of Ruby we use.
It can also cause logic errors since it can raise in
any callee scope. Use client library timeouts and monitoring to
ensure proper timing behavior for web requests.
Enabled: true
Airbnb/OptArgParameters:
Description: Do not use default arguments. Use an options hash instead.
Enabled: true
StyleGuide: https://github.com/airbnb/ruby#no-default-args
Airbnb/PhraseBundleKeys:
Description: Checks for phrase bundle keys that do not match their respective translation keys.
Enabled: true
Airbnb/RiskyActiverecordInvocation:
Description: Disallow ActiveRecord calls that use interpolated or added strings as arguments.
Enabled: true
Airbnb/RspecEnvironmentModification:
Description: Disallow Rails.env from being stubbed in half measure ways or from being reassigned
Use `stub_env` instead.
Enabled: true
Airbnb/SimpleModifierConditional:
Enabled: true
StyleGuide: https://github.com/airbnb/ruby#only-simple-if-unless
Airbnb/SimpleUnless:
Enabled: true
StyleGuide: https://github.com/airbnb/ruby#unless-with-multiple-conditions
Airbnb/SpecConstantAssignment:
Description: Constant assignment in specs polute global namespace and are a cause of spurious
specs. They should be avoided. Also modifing existing constants is bad too, use stub_const
instead
Enabled: true
Airbnb/UnsafeYamlMarshal:
Description: Avoid use of YAML/Marshal methods that can trigger RCE on untrusted input.
Enabled: true