Skip to content

Commit 49e390b

Browse files
committed
yard, rubocop and lower ruby to 2.7
1 parent 0339a40 commit 49e390b

File tree

10 files changed

+643
-0
lines changed

10 files changed

+643
-0
lines changed

.rubocop.yml

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
# https://evilmartians.com/chronicles/rubocoping-with-legacy-bring-your-ruby-code-up-to-standard
2+
inherit_mode:
3+
merge:
4+
- Exclude
5+
6+
inherit_from:
7+
- .rubocop/rails.yml
8+
- .rubocop_todo.yml
9+
- .rubocop/strict.yml
10+
# - .rubocop/rspec.yml
11+
# - node_modules/@prettier/plugin-ruby/rubocop.yml
12+
13+
require:
14+
- rubocop-performance
15+
- rubocop-rake
16+
# - rubocop-minitest
17+
18+
AllCops:
19+
TargetRubyVersion: 3.2
20+
TargetRailsVersion: 7.0
21+
SuggestExtensions: false
22+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
23+
# to ignore them, so only the ones explicitly set in this file are enabled.
24+
DisabledByDefault: true
25+
Exclude:
26+
- 'db/**/*'
27+
- 'config/**/*'
28+
- 'script/**/*'
29+
- '**/Gemfile.lock'
30+
- '**/Rakefile'
31+
- '**/rails'
32+
- '**/vendor/**/*'
33+
- '**/spec_helper.rb'
34+
- 'node_modules/**/*'
35+
- 'bin/*'
36+
- !ruby/regexp /old_and_unused\.rb$/
37+
38+
Layout/LineLength:
39+
Max: 300
40+
AllowedPatterns:
41+
- !ruby/regexp /\A#/
42+
43+
# Prefer &&/|| over and/or.
44+
Style/AndOr:
45+
Enabled: true
46+
47+
# Align `when` with `case`.
48+
Layout/CaseIndentation:
49+
Enabled: true
50+
51+
Layout/ClosingHeredocIndentation:
52+
Enabled: true
53+
54+
Layout/ClosingParenthesisIndentation:
55+
Enabled: true
56+
57+
# Align comments with method definitions.
58+
Layout/CommentIndentation:
59+
Enabled: true
60+
61+
Layout/ElseAlignment:
62+
Enabled: true
63+
64+
# Align `end` with the matching keyword or starting expression except for
65+
# assignments, where it should be aligned with the LHS.
66+
Layout/EndAlignment:
67+
Enabled: true
68+
EnforcedStyleAlignWith: variable
69+
AutoCorrect: true
70+
71+
Layout/EndOfLine:
72+
Enabled: true
73+
74+
Layout/EmptyLineAfterMagicComment:
75+
Enabled: true
76+
77+
Layout/EmptyLinesAroundAccessModifier:
78+
Enabled: true
79+
EnforcedStyle: only_before
80+
81+
Layout/EmptyLinesAroundBlockBody:
82+
Enabled: true
83+
84+
# In a regular class definition, no empty lines around the body.
85+
Layout/EmptyLinesAroundClassBody:
86+
Enabled: true
87+
88+
# In a regular method definition, no empty lines around the body.
89+
Layout/EmptyLinesAroundMethodBody:
90+
Enabled: true
91+
92+
# In a regular module definition, no empty lines around the body.
93+
Layout/EmptyLinesAroundModuleBody:
94+
Enabled: true
95+
96+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
97+
Style/HashSyntax:
98+
Enabled: true
99+
100+
# Method definitions after `private` or `protected` isolated calls need one
101+
# extra level of indentation.
102+
Layout/IndentationConsistency:
103+
Enabled: true
104+
EnforcedStyle: indented_internal_methods
105+
Exclude:
106+
- '**/*.md'
107+
108+
# Two spaces, no tabs (for indentation).
109+
Layout/IndentationWidth:
110+
Enabled: true
111+
112+
Layout/LeadingCommentSpace:
113+
Enabled: true
114+
115+
Layout/SpaceAfterColon:
116+
Enabled: true
117+
118+
Layout/SpaceAfterComma:
119+
Enabled: true
120+
121+
Layout/SpaceAfterSemicolon:
122+
Enabled: true
123+
124+
Layout/SpaceAroundEqualsInParameterDefault:
125+
Enabled: true
126+
127+
Layout/SpaceAroundKeyword:
128+
Enabled: true
129+
130+
Layout/SpaceAroundOperators:
131+
Enabled: true
132+
133+
Layout/SpaceBeforeComma:
134+
Enabled: true
135+
136+
Layout/SpaceBeforeComment:
137+
Enabled: true
138+
139+
Layout/SpaceBeforeFirstArg:
140+
Enabled: true
141+
142+
Style/DefWithParentheses:
143+
Enabled: true
144+
145+
# Defining a method with parameters needs parentheses.
146+
Style/MethodDefParentheses:
147+
Enabled: true
148+
149+
Style/ExplicitBlockArgument:
150+
Enabled: true
151+
152+
Style/FrozenStringLiteralComment:
153+
Enabled: true
154+
EnforcedStyle: never
155+
# Exclude:
156+
# - 'actionview/test/**/*.builder'
157+
# - 'actionview/test/**/*.ruby'
158+
# - 'actionpack/test/**/*.builder'
159+
# - 'actionpack/test/**/*.ruby'
160+
# - 'activestorage/db/migrate/**/*.rb'
161+
# - 'activestorage/db/update_migrate/**/*.rb'
162+
# - 'actionmailbox/db/migrate/**/*.rb'
163+
# - 'actiontext/db/migrate/**/*.rb'
164+
# - '**/*.md'
165+
166+
Style/MapToHash:
167+
Enabled: true
168+
169+
Style/RedundantFreeze:
170+
Enabled: true
171+
172+
# Use `foo {}` not `foo{}`.
173+
Layout/SpaceBeforeBlockBraces:
174+
Enabled: true
175+
176+
# Use `foo { bar }` not `foo {bar}`.
177+
Layout/SpaceInsideBlockBraces:
178+
Enabled: true
179+
EnforcedStyleForEmptyBraces: space
180+
181+
# Use `{ a: 1 }` not `{a:1}`.
182+
Layout/SpaceInsideHashLiteralBraces:
183+
Enabled: true
184+
185+
Layout/SpaceInsideParens:
186+
Enabled: true
187+
188+
# Check quotes usage according to lint rule below.
189+
Style/StringLiterals:
190+
Enabled: true
191+
EnforcedStyle: double_quotes
192+
193+
# Detect hard tabs, no hard tabs.
194+
Layout/IndentationStyle:
195+
Enabled: true
196+
197+
# Empty lines should not have any spaces.
198+
Layout/TrailingEmptyLines:
199+
Enabled: true
200+
201+
# No trailing whitespace.
202+
Layout/TrailingWhitespace:
203+
Enabled: true
204+
205+
# Use quotes for string literals when they are enough.
206+
Style/RedundantPercentQ:
207+
Enabled: true
208+
209+
Lint/AmbiguousOperator:
210+
Enabled: true
211+
212+
Lint/AmbiguousRegexpLiteral:
213+
Enabled: true
214+
215+
Lint/DuplicateRequire:
216+
Enabled: true
217+
218+
Lint/DuplicateMagicComment:
219+
Enabled: true
220+
221+
Lint/DuplicateMethods:
222+
Enabled: true
223+
224+
Lint/ErbNewArguments:
225+
Enabled: true
226+
227+
Lint/EnsureReturn:
228+
Enabled: true
229+
230+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
231+
Lint/RequireParentheses:
232+
Enabled: true
233+
234+
Lint/RedundantStringCoercion:
235+
Enabled: true
236+
237+
Lint/UriEscapeUnescape:
238+
Enabled: true
239+
240+
Lint/UselessAssignment:
241+
Enabled: true
242+
243+
Lint/DeprecatedClassMethods:
244+
Enabled: true
245+
246+
Style/EvalWithLocation:
247+
Enabled: true
248+
Exclude:
249+
- '**/test/**/*'
250+
251+
Style/ParenthesesAroundCondition:
252+
Enabled: true
253+
254+
Style/HashTransformKeys:
255+
Enabled: true
256+
257+
Style/HashTransformValues:
258+
Enabled: true
259+
260+
Style/RedundantBegin:
261+
Enabled: true
262+
263+
Style/RedundantReturn:
264+
Enabled: true
265+
AllowMultipleReturnValues: true
266+
267+
Style/RedundantRegexpEscape:
268+
Enabled: true
269+
270+
Style/Semicolon:
271+
Enabled: true
272+
AllowAsExpressionSeparator: true
273+
274+
# Prefer Foo.method over Foo::method
275+
Style/ColonMethodCall:
276+
Enabled: true
277+
278+
Style/TrivialAccessors:
279+
Enabled: true
280+
281+
# Prefer a = b || c over a = b ? b : c
282+
Style/RedundantCondition:
283+
Enabled: true

.rubocop/markdown.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Markdown:
2+
# Whether to run RuboCop against non-valid snippets
3+
WarnInvalid: false
4+
# Whether to lint codeblocks without code attributes
5+
Autodetect: false

.rubocop/minitest.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Minitest/AssertRaisesWithRegexpArgument:
2+
Enabled: true
3+
4+
Minitest/AssertWithExpectedArgument:
5+
Enabled: true
6+
7+
Minitest/SkipEnsure:
8+
Enabled: true
9+
10+
Minitest/UnreachableAssertion:
11+
Enabled: true

0 commit comments

Comments
 (0)