about summary refs log tree commit diff
path: root/.rubocop.yml
blob: 0a41c54b905a2aef081bf0610198c723db339cd4 (plain) (blame)
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
inherit_from: .rubocop_todo.yml

inherit_mode:
  merge:
    - Exclude

require:
  - rubocop-rails
  - rubocop-rspec
  - rubocop-performance

AllCops:
  TargetRubyVersion: 2.7
  DisplayCopNames: true
  DisplayStyleGuide: true
  ExtraDetails: true
  UseCache: true
  CacheRootDirectory: tmp
  NewCops: enable
  Exclude:
    - db/schema.rb
    - 'app/views/**/*'
    - 'config/**/*'
    - 'bin/*'
    - 'Rakefile'
    - 'node_modules/**/*'
    - 'Vagrantfile'
    - 'vendor/**/*'
    - 'lib/json_ld/*'
    - 'lib/templates/**/*'

Layout/FirstHashElementIndentation:
  EnforcedStyle: consistent

Layout/LineLength:
  Max: 140 # RuboCop default 120
  AllowedPatterns:
    # Allow comments to be long lines
    - !ruby/regexp / \# .*$/
    - !ruby/regexp /^\# .*$/
  Exclude:
    - lib/**/*cli*.rb
    - db/*migrate/**/*
    - db/seeds/**/*

Lint/UselessAccessModifier:
  ContextCreatingMethods:
    - class_methods

Metrics/AbcSize:
  Max: 34 # RuboCop default 17
  Exclude:
    - 'lib/**/*cli*.rb'
    - db/*migrate/**/*

Metrics/BlockLength:
  Max: 55 # Default 25
  CountAsOne: [array, heredoc]
  Exclude:
    - 'lib/mastodon/*_cli.rb'

Metrics/BlockNesting:
  Exclude:
    - 'lib/mastodon/*_cli.rb'

Metrics/ClassLength:
  Max: 500 # Default 100
  CountAsOne: [array, heredoc]
  Exclude:
    - 'lib/mastodon/*_cli.rb'

Metrics/CyclomaticComplexity:
  Max: 12 # Default 7
  Exclude:
    - lib/mastodon/*cli*.rb
    - db/*migrate/**/*

Metrics/MethodLength:
  Max: 25 # RuboCop default 10
  CountAsOne: [array, heredoc]
  Exclude:
    - 'lib/mastodon/*_cli.rb'

Metrics/ModuleLength:
  Max: 200 # Default 100
  CountAsOne: [array, heredoc]

Metrics/PerceivedComplexity:
  Max: 16 # RuboCop default 8

Rails/HttpStatus:
  EnforcedStyle: numeric

Rails/Exit:
  Exclude:
    - 'lib/mastodon/*_cli.rb'
    - 'lib/mastodon/cli_helper.rb'
    - 'lib/cli.rb'

RSpec/FilePath:
  CustomTransform:
    DeepL: deepl

RSpec/NotToNot:
  EnforcedStyle: to_not

RSpec/Rails/HttpStatus:
  EnforcedStyle: numeric

Style/HashSyntax:
  EnforcedStyle: ruby19_no_mixed_keys

Style/NumericLiterals:
  AllowedPatterns:
    - \d{4}_\d{2}_\d{2}_\d{6} # For DB migration date version number readability

Style/PercentLiteralDelimiters:
  PreferredDelimiters:
    '%i': '()'
    '%w': '()'

Style/RescueStandardError:
  EnforcedStyle: implicit

Style/TrailingCommaInArrayLiteral:
  EnforcedStyleForMultiline: 'comma'

Style/TrailingCommaInHashLiteral:
  EnforcedStyleForMultiline: 'comma'