-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathforced_rubocop_config.yml
192 lines (165 loc) · 6.63 KB
/
forced_rubocop_config.yml
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
# These are some configurations that are required for RuboCop because:
# * HAML-Lint compiles ruby code with a particular format. If the rules mis-match that format,
# HAML-Lint would generate lints that the user cannot fix.
# * HAML-Lint can autocorrect code only if the result matches some specific format
#
# So these configuration should not be overwritable by users.
Layout/ArgumentAlignment:
# The alternative, with_fixed_indentation, breaks because we sometimes remove indentation when
# dealing with multi-line scripts. (Because a line starting with "=" adds a "HL.out = " to the
# intermediary Ruby source, which requires indentation, and the removal of the indentation)
EnforcedStyle: with_first_argument
Layout/ArrayAlignment:
# The alternative, with_fixed_indentation, breaks because we sometimes remove indentation when
# dealing with multi-line scripts. (Because a line starting with "=" adds a "HL.out = " to the
# intermediary Ruby source, which requires indentation, and the removal of the indentation)
EnforcedStyle: with_first_element
# In Haml, there are edge cases when `when` is indented, such as this one:
# - case 1
# - when 1
# - when 2
# foo
# This generates 2 `end` when building Ruby.
# So it's safer to make the `when` be not indented, to avoid auto-correct chains that could turn
# a valid `if` into an invalid `case` such as above.
Layout/CaseIndentation:
Enabled: true
EnforcedStyle: end
IndentOneStep: false # Need to force the `false`
# Need this cop so that code gets formatted similarly to Haml's indentation,
# since HAML-Lint relies on Ruby's indentation being the same as Haml's.
Layout/ElseAlignment:
Enabled: true
# Need this cop so that code gets formatted similarly to Haml's indentation,
# since HAML-Lint relies on Ruby's indentation being the same as Haml's.
Layout/EndAlignment:
EnforcedStyleAlignWith: start_of_line
Enabled: true
# We generate the ruby content, this is basically useless and should be a lint in HAML-Lint
Layout/EndOfLine:
Enabled: false
# Complying with this lint requires the use of pipes which causes a conflict with MultilinePipe.
Layout/FirstArrayElementLineBreak:
Enabled: false
# Complying with this lint requires the use of pipes which causes a conflict with MultilinePipe.
Layout/FirstHashElementLineBreak:
Enabled: false
# Complying with this lint requires the use of pipes which causes a conflict with MultilinePipe.
Layout/FirstMethodArgumentLineBreak:
Enabled: false
# Turning this cop on can turn
# = content_tag(:span) do
# - foo
# - bar
#
# Into
# - HL.out =
# - content_tag(:span) do
# - foo
# - bar
#
# Which is wrong... It would take too much analysis to detect and fix that situation.
Layout/MultilineAssignmentLayout:
Enabled: false
Layout/ParameterAlignment:
# The alternative, with_fixed_indentation, breaks because we sometimes remove indentation when
# dealing with multi-line scripts. (Because a line starting with "=" adds a "HL.out = " to the
# intermediary Ruby source, which requires indentation, and the removal of the indentation)
EnforcedStyle: with_first_parameter
# HamlLint generate lots of extra code which would make blocks much longer
Metrics/BlockLength:
Enabled: false
# The nesting may be due to the html's nesting nature... These lints are probably not helpful
Metrics/BlockNesting:
Enabled: false
# The file names are generated by HamlLint, so any related lint would be unfixable by the user
Naming/FileName:
Enabled: false
# HAML doesn't properly support multiline blocks using { }, only using do/end.
# If you don't consider the { } block for indentation, things "works", but the indentation is misleading.
# For example, this works:
# - a = lambda {
# - if abc
# - something
# - }
# But if you indented the 2 lines within { }, then HAML would add an extra `end` and the generated
# ruby would be invalid.
Style/BlockDelimiters:
# So we need this cop to cleanup those cases and turn them to `end`.
Enabled: true
EnforcedStyle: line_count_based
# We don't allow the default "Can be anything" exception for lambda/proc
<%= rubocop_version < '1.33' ? 'IgnoredMethods' : 'AllowedMethods' %>: []
# We don't support correcting HAML comments
Style/CommentAnnotation:
AutoCorrect: false
# If this was enabled, the equal sign would bubble up in a if like this:
# - if a
# = abc
# - else
# = bcd
# Into:
# = if a
# - abc
# - else
# - bcd
# Feels like this might be annoying or less visibly intuitive.
Style/ConditionalAssignment:
Enabled: false
# If this gets added, it wont do anything anyways.
Style/FrozenStringLiteralComment:
Enabled: false
# Looking at the changelog, this cop has quite a few bugfixes over time.
# It still has problematic behaviors for us, such as breaking a line into multiple
# ones with high indentation, which doesn't work for haml
Style/IfUnlessModifier:
AutoCorrect: false
<% if rubocop_version >= '1.37.0' %>
# This new cop can trigger on the here-doc we use for filters that contain interpolation.
# Ex:
# :javascript
# hello #{world} \. bad escape
Style/RedundantStringEscape:
Enabled: false
<% end %>
# In some case, this cop can cause a change in the spacing.
# In HAML 5.2, going from (absurd example for clarity):
# = 'abc' rescue nil
# = 'def'
# to:
# = begin
# - 'abc'
# - rescue StandardError
# - nil
# = 'def'
# Will remove the only whitespace (a \n) that is between the abc and the def.
# This could affect spacing, ex: seeing "abc def" become "abcdef" when rendering
# after running this auto-correct
Style/RescueModifier:
AutoCorrect: false
# Cops that remove commas can be a problem when lines are split on multiple ones.
# If we have a big array on more than one line, the removal of the comma generates
# invalid HAML
Style/SymbolArray:
Enabled: false
# This can easily change the order of the markers in the document, which result in un-transferable corrections
Style/UnlessElse:
AutoCorrect: false
# If an array of strings was on multiple lines, this cop will make a %w(...) on multiple lines.
# Without the comma at the end of the first line, there the resulting HAML will be invalid, since the only
# case where a script can change line is after a comma.
Style/WordArray:
AutoCorrect: false
# Not RuboCop's job
Layout/TrailingEmptyLines:
Enabled: false
<% if rubocop_version < '1.8.1' %>
# There were a few bugs with this cop that got fixed in this version.
# Before, those bugs would generate invalid Ruby code and that would make it look like HAML-lint is
# responsible, at least from the user's point of view.
Style/StringConcatenation:
Enabled: false
<% end %>
# There is already a linter dedicated to this in haml-lint
Layout/LineLength:
Enabled: false