Skip to content

Commit 10d7fb4

Browse files
committed
add Hound and Rubocop configuration
1 parent a49b3e4 commit 10d7fb4

File tree

2 files changed

+246
-0
lines changed

2 files changed

+246
-0
lines changed

.hound.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ruby:
2+
config_file: .rubocop.yml

.rubocop.yml

+244
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
AllCops:
2+
Exclude:
3+
- "vendor/**/*"
4+
- "db/schema.rb"
5+
- "lib/generators/ruby_stackoverflow/templates/*.rb"
6+
UseCache: false
7+
Style/CollectionMethods:
8+
Description: Preferred collection methods.
9+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
10+
Enabled: true
11+
PreferredMethods:
12+
collect: map
13+
collect!: map!
14+
find: detect
15+
find_all: select
16+
reduce: inject
17+
Style/DotPosition:
18+
Description: Checks the position of the dot in multi-line method calls.
19+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
20+
Enabled: true
21+
EnforcedStyle: trailing
22+
SupportedStyles:
23+
- leading
24+
- trailing
25+
Style/FileName:
26+
Description: Use snake_case for source file names.
27+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
28+
Enabled: false
29+
Exclude: []
30+
Style/GuardClause:
31+
Description: Check for conditionals that can be replaced with guard clauses
32+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
33+
Enabled: false
34+
MinBodyLength: 1
35+
Style/IfUnlessModifier:
36+
Description: Favor modifier if/unless usage when you have a single-line body.
37+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
38+
Enabled: false
39+
MaxLineLength: 80
40+
Style/OptionHash:
41+
Description: Don't use option hashes when you can use keyword arguments.
42+
Enabled: false
43+
Style/PercentLiteralDelimiters:
44+
Description: Use `%`-literal delimiters consistently
45+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
46+
Enabled: false
47+
PreferredDelimiters:
48+
"%": "()"
49+
"%i": "()"
50+
"%q": "()"
51+
"%Q": "()"
52+
"%r": "{}"
53+
"%s": "()"
54+
"%w": "()"
55+
"%W": "()"
56+
"%x": "()"
57+
Style/PredicateName:
58+
Description: Check the names of predicate methods.
59+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
60+
Enabled: true
61+
NamePrefix:
62+
- is_
63+
- has_
64+
- have_
65+
NamePrefixBlacklist:
66+
- is_
67+
Exclude:
68+
- spec/**/*
69+
Style/RaiseArgs:
70+
Description: Checks the arguments passed to raise/fail.
71+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
72+
Enabled: false
73+
EnforcedStyle: exploded
74+
SupportedStyles:
75+
- compact
76+
- exploded
77+
Style/SignalException:
78+
Description: Checks for proper usage of fail and raise.
79+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
80+
Enabled: false
81+
EnforcedStyle: semantic
82+
SupportedStyles:
83+
- only_raise
84+
- only_fail
85+
- semantic
86+
Style/SingleLineBlockParams:
87+
Description: Enforces the names of some block params.
88+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
89+
Enabled: false
90+
Methods:
91+
- reduce:
92+
- a
93+
- e
94+
- inject:
95+
- a
96+
- e
97+
Style/SingleLineMethods:
98+
Description: Avoid single-line methods.
99+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
100+
Enabled: false
101+
AllowIfMethodIsEmpty: true
102+
Style/StringLiterals:
103+
Description: Checks if uses of quotes match the configured preference.
104+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
105+
Enabled: true
106+
EnforcedStyle: double_quotes
107+
SupportedStyles:
108+
- single_quotes
109+
- double_quotes
110+
Style/StringLiteralsInInterpolation:
111+
Description: Checks if uses of quotes inside expressions in interpolated strings
112+
match the configured preference.
113+
Enabled: true
114+
EnforcedStyle: single_quotes
115+
SupportedStyles:
116+
- single_quotes
117+
- double_quotes
118+
Style/TrailingCommaInArguments:
119+
Description: 'Checks for trailing comma in argument lists.'
120+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
121+
Enabled: false
122+
EnforcedStyleForMultiline: no_comma
123+
SupportedStyles:
124+
- comma
125+
- consistent_comma
126+
- no_comma
127+
Style/TrailingCommaInLiteral:
128+
Description: 'Checks for trailing comma in array and hash literals.'
129+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
130+
Enabled: false
131+
EnforcedStyleForMultiline: no_comma
132+
SupportedStyles:
133+
- comma
134+
- consistent_comma
135+
- no_comma
136+
Metrics/AbcSize:
137+
Description: A calculated magnitude based on number of assignments, branches, and
138+
conditions.
139+
Enabled: false
140+
Max: 15
141+
Metrics/ClassLength:
142+
Description: Avoid classes longer than 100 lines of code.
143+
Enabled: false
144+
CountComments: false
145+
Max: 100
146+
Metrics/ModuleLength:
147+
CountComments: false
148+
Max: 100
149+
Description: Avoid modules longer than 100 lines of code.
150+
Enabled: false
151+
Metrics/CyclomaticComplexity:
152+
Description: A complexity metric that is strongly correlated to the number of test
153+
cases needed to validate a method.
154+
Enabled: false
155+
Max: 6
156+
Metrics/MethodLength:
157+
Description: Avoid methods longer than 10 lines of code.
158+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
159+
Enabled: false
160+
CountComments: false
161+
Max: 10
162+
Metrics/ParameterLists:
163+
Description: Avoid parameter lists longer than three or four parameters.
164+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
165+
Enabled: false
166+
Max: 5
167+
CountKeywordArgs: true
168+
Metrics/PerceivedComplexity:
169+
Description: A complexity metric geared towards measuring complexity for a human
170+
reader.
171+
Enabled: false
172+
Max: 7
173+
Lint/AssignmentInCondition:
174+
Description: Don't use assignment in conditions.
175+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
176+
Enabled: false
177+
AllowSafeAssignment: true
178+
Style/InlineComment:
179+
Description: Avoid inline comments.
180+
Enabled: false
181+
Style/AccessorMethodName:
182+
Description: Check the naming of accessor methods for get_/set_.
183+
Enabled: false
184+
Style/Alias:
185+
Description: Use alias_method instead of alias.
186+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
187+
Enabled: false
188+
Style/Documentation:
189+
Description: Document classes and non-namespace modules.
190+
Enabled: false
191+
Style/DoubleNegation:
192+
Description: Checks for uses of double negation (!!).
193+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
194+
Enabled: false
195+
Style/EachWithObject:
196+
Description: Prefer `each_with_object` over `inject` or `reduce`.
197+
Enabled: false
198+
Style/EmptyLiteral:
199+
Description: Prefer literals to Array.new/Hash.new/String.new.
200+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
201+
Enabled: false
202+
Style/ModuleFunction:
203+
Description: Checks for usage of `extend self` in modules.
204+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
205+
Enabled: false
206+
Style/OneLineConditional:
207+
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
208+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
209+
Enabled: false
210+
Style/PerlBackrefs:
211+
Description: Avoid Perl-style regex back references.
212+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
213+
Enabled: false
214+
Style/Send:
215+
Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
216+
may overlap with existing methods.
217+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
218+
Enabled: false
219+
Style/SpecialGlobalVars:
220+
Description: Avoid Perl-style global variables.
221+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
222+
Enabled: false
223+
Style/VariableInterpolation:
224+
Description: Don't interpolate global, instance and class variables directly in
225+
strings.
226+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
227+
Enabled: false
228+
Style/WhenThen:
229+
Description: Use when x then ... for one-line cases.
230+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
231+
Enabled: false
232+
Lint/EachWithObjectArgument:
233+
Description: Check for immutable argument given to each_with_object.
234+
Enabled: true
235+
Lint/HandleExceptions:
236+
Description: Don't suppress exception.
237+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
238+
Enabled: false
239+
Lint/LiteralInCondition:
240+
Description: Checks of literals used in conditions.
241+
Enabled: false
242+
Lint/LiteralInInterpolation:
243+
Description: Checks for literals used in interpolation.
244+
Enabled: false

0 commit comments

Comments
 (0)