Project

General

Profile

1
inherit_from: .rubocop_todo.yml
2

    
3
AllCops:
4
  TargetRubyVersion: 2.7
5
  TargetRailsVersion: 7.1
6

    
7
  NewCops: enable
8

    
9
  Exclude:
10
    - '**/vendor/**/*'
11
    - '**/tmp/**/*'
12
    - '**/bin/**/*'
13
    - '**/plugins/**/*'
14
    - '**/extra/**/*'
15
    - '**/lib/generators/**/templates/*'
16
    - '**/lib/tasks/**/*'
17
    - '**/files/**/*'
18
    - 'db/schema.rb'
19

    
20
# Enable extensions
21

    
22
require:
23
  - rubocop-performance
24
  - rubocop-rails
25

    
26
# Rules for Redmine
27

    
28
Bundler/OrderedGems:
29
  Enabled: false
30

    
31
Layout/CaseIndentation:
32
  Exclude:
33
    - 'config/initializers/10-patches.rb'
34

    
35
Layout/ClosingParenthesisIndentation:
36
  Exclude:
37
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
38

    
39
Layout/EmptyLinesAroundAccessModifier:
40
  Exclude:
41
    - 'config/initializers/10-patches.rb'
42

    
43
Layout/EmptyLineBetweenDefs:
44
  AllowAdjacentOneLineDefs: true
45

    
46
Layout/FirstHashElementIndentation:
47
  Exclude:
48
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
49

    
50
Layout/LineLength:
51
  AllowedPatterns: ['\A\s+test \".+\" do\z', '\A\s*\#']
52
  Exclude:
53
    - 'db/migrate/0*.rb'
54
    - 'db/migrate/1*.rb'
55
    - 'db/migrate/201*.rb'
56
    - 'db/migrate/20200*.rb'
57
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
58

    
59
Layout/RescueEnsureAlignment:
60
  Exclude:
61
    - 'db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb'
62

    
63
Layout/SpaceAroundEqualsInParameterDefault:
64
  Enabled: false
65

    
66
Layout/SpaceBeforeSemicolon:
67
  Exclude:
68
    - 'config/initializers/10-patches.rb'
69

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

    
76
Layout/SpaceBeforeFirstArg:
77
  Enabled: false
78

    
79
Layout/SpaceInsideBlockBraces:
80
  Enabled: false
81

    
82
Layout/SpaceInsideHashLiteralBraces:
83
  Enabled: false
84

    
85
Lint/MissingSuper:
86
  Exclude:
87
    - 'lib/redmine/views/builders/structure.rb'
88

    
89
Lint/SuppressedException:
90
  AllowComments: true
91

    
92
Layout/LineContinuationLeadingSpace:
93
  Enabled: false
94

    
95
Layout/TrailingWhitespace:
96
  AllowInHeredoc: true
97

    
98
Metrics:
99
  Enabled: false
100

    
101
Naming/AccessorMethodName:
102
  Enabled: false
103

    
104
Naming/VariableNumber:
105
  CheckMethodNames: false
106
  CheckSymbols: false
107

    
108
Naming/BinaryOperatorParameterName:
109
  Enabled: false
110

    
111
Naming/PredicateName:
112
  Enabled: false
113

    
114
Performance/CollectionLiteralInLoop:
115
  MinSize: 4
116

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

    
121
Rails/ActionControllerTestCase:
122
  Enabled: false
123

    
124
Rails/ActionOrder:
125
  Enabled: false
126

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

    
132
Rails/BulkChangeTable:
133
  Exclude:
134
    - 'db/migrate/20120714122200_add_workflows_rule_fields.rb'
135
    - 'db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb'
136

    
137
Rails/CompactBlank:
138
  Enabled: false
139

    
140
Rails/Delegate:
141
  Enabled: false
142

    
143
Rails/EnvironmentVariableAccess:
144
  Enabled: false
145

    
146
Rails/FilePath:
147
  Enabled: false
148

    
149
Rails/FindEach:
150
  Enabled: false
151

    
152
Rails/HelperInstanceVariable:
153
  Enabled: false
154

    
155
Rails/Pluck:
156
  Exclude:
157
  # `pluck` is not available in Gemfile
158
  - 'Gemfile'
159

    
160
Rails/RootPathnameMethods:
161
  Enabled: false
162

    
163
Rails/SquishedSQLHeredocs:
164
  Enabled: false
165

    
166
Rails/ThreeStateBooleanColumn:
167
  Exclude:
168
    - 'db/migrate/009_add_hide_mail_pref.rb'
169
    - 'db/migrate/059_add_roles_assignable.rb'
170
    - 'db/migrate/082_add_messages_locked.rb'
171
    - 'db/migrate/086_add_custom_fields_searchable.rb'
172
    - 'db/migrate/102_add_custom_fields_editable.rb'
173
    - 'db/migrate/20120115143100_add_repositories_is_default.rb'
174
    - 'db/migrate/20120127174243_add_custom_fields_multiple.rb'
175
    - 'db/migrate/20210704125704_add_twofa_required_to_groups.rb'
176

    
177
Rails/WhereExists:
178
  Enabled: false
179

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

    
186
Style/BlockComments:
187
  Exclude:
188
    - 'lib/redmine/string_array_diff/diff.rb'
189
    - 'lib/redmine/string_array_diff/diffable.rb'
190

    
191
Style/BlockDelimiters:
192
  Exclude:
193
    - 'db/migrate/007_create_journals.rb'
194
    - 'lib/redmine/string_array_diff/diff.rb'
195
    - 'lib/redmine/string_array_diff/diffable.rb'
196

    
197
Style/FetchEnvVar:
198
  Enabled: false
199

    
200
Style/EmptyElse:
201
  EnforcedStyle: empty
202

    
203
Style/FormatString:
204
  EnforcedStyle: sprintf
205

    
206
Style/FormatStringToken:
207
  Enabled: false
208

    
209
Style/FrozenStringLiteralComment:
210
  EnforcedStyle: always
211
  Exclude:
212
    - 'db/**/*.rb'
213
    - 'Gemfile'
214
    - 'Rakefile'
215
    - 'config.ru'
216
    - 'config/additional_environment.rb'
217

    
218
Style/GlobalStdStream:
219
  Enabled: false
220

    
221
Style/HashSyntax:
222
  EnforcedStyle: no_mixed_keys
223

    
224
Style/IdenticalConditionalBranches:
225
  Exclude:
226
    - 'config/initializers/10-patches.rb'
227
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
228

    
229
Style/InverseMethods:
230
  Enabled: false
231

    
232
Style/NegatedIfElseCondition:
233
  Enabled: false
234

    
235
Style/RaiseArgs:
236
  Enabled: false
237

    
238
Style/RedundantConstantBase:
239
  Exclude:
240
    - 'config/environments/production.rb'
241

    
242
Style/Semicolon:
243
  Enabled: false
244

    
245
Style/SlicingWithRange:
246
  Enabled: false
247

    
248
Style/SoleNestedConditional:
249
  Enabled: false
250

    
251
Style/StringLiteralsInInterpolation:
252
  Enabled: false
253

    
254
Style/TernaryParentheses:
255
  Enabled: false
256

    
257
Style/TrailingCommaInArrayLiteral:
258
  Enabled: false
259

    
260
Style/TrailingCommaInHashLiteral:
261
  Enabled: false
262

    
263
Style/YodaExpression:
264
  Enabled: false
(3-3/14)