summaryrefslogtreecommitdiffstats
path: root/.rubocop.yml
blob: bc24065bea49dd362d0b1276749ed9ef3cdcc80e (plain)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
inherit_from: .rubocop_todo.yml

AllCops:
  TargetRubyVersion: 2.7
  TargetRailsVersion: 6.1

  NewCops: enable

  Exclude:
    - '**/vendor/**/*'
    - '**/tmp/**/*'
    - '**/bin/**/*'
    - '**/plugins/**/*'
    - '**/extra/**/*'
    - '**/lib/generators/**/templates/*'
    - '**/lib/tasks/**/*'
    - '**/files/**/*'
    - 'db/schema.rb'

# Enable extensions

require:
  - rubocop-performance
  - rubocop-rails

# Rules for Redmine

Bundler/OrderedGems:
  Enabled: false

Layout/CaseIndentation:
  Exclude:
    - 'config/initializers/10-patches.rb'

Layout/ClosingParenthesisIndentation:
  Exclude:
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'

Layout/EmptyLinesAroundAccessModifier:
  Exclude:
    - 'config/initializers/10-patches.rb'

Layout/EmptyLineBetweenDefs:
  AllowAdjacentOneLineDefs: true

Layout/FirstHashElementIndentation:
  Exclude:
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'

Layout/LineLength:
  AllowedPatterns: ['\A\s+test \".+\" do\z', '\A\s*\#']
  Exclude:
    - 'db/migrate/0*.rb'
    - 'db/migrate/1*.rb'
    - 'db/migrate/201*.rb'
    - 'db/migrate/20200*.rb'
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'

Layout/RescueEnsureAlignment:
  Exclude:
    - 'db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb'

Layout/SpaceAroundEqualsInParameterDefault:
  Enabled: false

Layout/SpaceBeforeSemicolon:
  Exclude:
    - 'config/initializers/10-patches.rb'

Layout/SpaceBeforeBlockBraces:
  # "space" is used more than "no_space".
  # But "no_space" is more natural in one liner.
  #   str = path.to_s.split(%r{[/\\]}).select{|p| !p.blank?}.join("/")
  Enabled: false

Layout/SpaceBeforeFirstArg:
  Enabled: false

Layout/SpaceInsideBlockBraces:
  Enabled: false

Layout/SpaceInsideHashLiteralBraces:
  Enabled: false

Lint/MissingSuper:
  Exclude:
    - 'lib/redmine/views/builders/structure.rb'

Lint/SuppressedException:
  AllowComments: true

Layout/LineContinuationLeadingSpace:
  Enabled: false

Layout/TrailingWhitespace:
  AllowInHeredoc: true

Metrics:
  Enabled: false

Naming/AccessorMethodName:
  Enabled: false

Naming/VariableNumber:
  CheckMethodNames: false
  CheckSymbols: false

Naming/BinaryOperatorParameterName:
  Enabled: false

Naming/PredicateName:
  Enabled: false

Performance/CollectionLiteralInLoop:
  MinSize: 4

Rails/ActionControllerFlashBeforeRender:
  # False positive in actions where `redirect_to_referer_or` is used
  Enabled: false

Rails/ActionControllerTestCase:
  Enabled: false

Rails/ActionOrder:
  Enabled: false

Rails/ActiveSupportOnLoad:
  Exclude:
    # TODO: Need to check the impact on plugins. Disable for now.
    - 'lib/redmine/preparation.rb'

Rails/BulkChangeTable:
  Exclude:
    - 'db/migrate/20120714122200_add_workflows_rule_fields.rb'
    - 'db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb'

Rails/CompactBlank:
  Enabled: false

Rails/Delegate:
  Enabled: false

Rails/EnvironmentVariableAccess:
  Enabled: false

Rails/FilePath:
  Enabled: false

Rails/FindEach:
  Enabled: false

Rails/HelperInstanceVariable:
  Enabled: false

Rails/Pluck:
  Exclude:
  # `pluck` is not available in Gemfile
  - 'Gemfile'

Rails/RootPathnameMethods:
  Enabled: false

Rails/SquishedSQLHeredocs:
  Enabled: false

Rails/ThreeStateBooleanColumn:
  Exclude:
    - 'db/migrate/009_add_hide_mail_pref.rb'
    - 'db/migrate/059_add_roles_assignable.rb'
    - 'db/migrate/082_add_messages_locked.rb'
    - 'db/migrate/086_add_custom_fields_searchable.rb'
    - 'db/migrate/102_add_custom_fields_editable.rb'
    - 'db/migrate/20120115143100_add_repositories_is_default.rb'
    - 'db/migrate/20120127174243_add_custom_fields_multiple.rb'
    - 'db/migrate/20210704125704_add_twofa_required_to_groups.rb'

Rails/WhereExists:
  Enabled: false

Style/AsciiComments:
  Exclude:
    # Copyright credit has non ascii character.
    # We can not change nor remove it.
    - 'app/models/repository/git.rb'

Style/BlockComments:
  Exclude:
    - 'lib/redmine/string_array_diff/diff.rb'
    - 'lib/redmine/string_array_diff/diffable.rb'

Style/BlockDelimiters:
  Exclude:
    - 'db/migrate/007_create_journals.rb'
    - 'lib/redmine/string_array_diff/diff.rb'
    - 'lib/redmine/string_array_diff/diffable.rb'

Style/FetchEnvVar:
  Enabled: false

Style/EmptyElse:
  EnforcedStyle: empty

Style/FormatString:
  EnforcedStyle: sprintf

Style/FormatStringToken:
  Enabled: false

Style/FrozenStringLiteralComment:
  EnforcedStyle: always
  Exclude:
    - 'db/**/*.rb'
    - 'Gemfile'
    - 'Rakefile'
    - 'config.ru'
    - 'config/additional_environment.rb'

Style/GlobalStdStream:
  Enabled: false

Style/HashSyntax:
  EnforcedStyle: no_mixed_keys

Style/IdenticalConditionalBranches:
  Exclude:
    - 'config/initializers/10-patches.rb'
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'

Style/InverseMethods:
  Enabled: false

Style/NegatedIfElseCondition:
  Enabled: false

Style/RaiseArgs:
  Enabled: false

Style/RedundantConstantBase:
  Exclude:
    - 'config/environments/production.rb'

Style/Semicolon:
  Enabled: false

Style/SlicingWithRange:
  Enabled: false

Style/SoleNestedConditional:
  Enabled: false

Style/StringLiteralsInInterpolation:
  Enabled: false

Style/TernaryParentheses:
  Enabled: false

Style/TrailingCommaInArrayLiteral:
  Enabled: false

Style/TrailingCommaInHashLiteral:
  Enabled: false

Style/YodaExpression:
  Enabled: false