tailor 1.0.0.alpha2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/.tailor +10 -2
- data/Gemfile.lock +2 -2
- data/History.rdoc +20 -0
- data/README.rdoc +176 -26
- data/features/configurable.feature +19 -39
- data/features/horizontal_spacing.feature +3 -2
- data/features/indentation.feature +2 -2
- data/features/indentation/bad_files_with_no_trailing_newline.feature +9 -8
- data/features/indentation/good_files_with_no_trailing_newline.feature +19 -6
- data/features/name_detection.feature +2 -2
- data/features/support/env.rb +0 -2
- data/features/support/file_cases/horizontal_spacing_cases.rb +5 -4
- data/features/support/file_cases/indentation_cases.rb +105 -54
- data/features/support/file_cases/naming_cases.rb +0 -1
- data/features/support/file_cases/vertical_spacing_cases.rb +0 -1
- data/features/support/legacy/bad_ternary_colon_spacing.rb +1 -1
- data/features/valid_ruby.feature +17 -0
- data/features/vertical_spacing.feature +40 -19
- data/lib/ext/string_ext.rb +12 -0
- data/lib/tailor/cli.rb +7 -5
- data/lib/tailor/cli/options.rb +13 -3
- data/lib/tailor/composite_observable.rb +17 -2
- data/lib/tailor/configuration.rb +83 -72
- data/lib/tailor/configuration/style.rb +85 -0
- data/lib/tailor/critic.rb +67 -117
- data/lib/tailor/formatter.rb +38 -0
- data/lib/tailor/formatters/text.rb +35 -10
- data/lib/tailor/lexed_line.rb +38 -5
- data/lib/tailor/lexer.rb +150 -14
- data/lib/tailor/{lexer_constants.rb → lexer/lexer_constants.rb} +9 -7
- data/lib/tailor/lexer/token.rb +6 -2
- data/lib/tailor/logger.rb +4 -0
- data/lib/tailor/problem.rb +8 -73
- data/lib/tailor/reporter.rb +1 -1
- data/lib/tailor/ruler.rb +67 -6
- data/lib/tailor/rulers/allow_camel_case_methods_ruler.rb +9 -1
- data/lib/tailor/rulers/allow_hard_tabs_ruler.rb +9 -1
- data/lib/tailor/rulers/allow_invalid_ruby_ruler.rb +38 -0
- data/lib/tailor/rulers/allow_screaming_snake_case_classes_ruler.rb +9 -2
- data/lib/tailor/rulers/allow_trailing_line_spaces_ruler.rb +10 -5
- data/lib/tailor/rulers/indentation_spaces_ruler.rb +93 -26
- data/lib/tailor/rulers/indentation_spaces_ruler/indentation_manager.rb +128 -84
- data/lib/tailor/rulers/max_code_lines_in_class_ruler.rb +9 -5
- data/lib/tailor/rulers/max_code_lines_in_method_ruler.rb +9 -5
- data/lib/tailor/rulers/max_line_length_ruler.rb +10 -5
- data/lib/tailor/rulers/spaces_after_comma_ruler.rb +13 -4
- data/lib/tailor/rulers/spaces_after_lbrace_ruler.rb +8 -4
- data/lib/tailor/rulers/spaces_after_lbracket_ruler.rb +8 -4
- data/lib/tailor/rulers/spaces_after_lparen_ruler.rb +8 -4
- data/lib/tailor/rulers/spaces_before_comma_ruler.rb +8 -4
- data/lib/tailor/rulers/spaces_before_lbrace_ruler.rb +13 -6
- data/lib/tailor/rulers/spaces_before_rbrace_ruler.rb +12 -8
- data/lib/tailor/rulers/spaces_before_rbracket_ruler.rb +12 -5
- data/lib/tailor/rulers/spaces_before_rparen_ruler.rb +13 -6
- data/lib/tailor/rulers/spaces_in_empty_braces_ruler.rb +13 -9
- data/lib/tailor/rulers/trailing_newlines_ruler.rb +10 -5
- data/lib/tailor/tailorrc.erb +3 -3
- data/lib/tailor/version.rb +1 -1
- data/m.rb +15 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/tailor/cli_spec.rb +8 -9
- data/spec/tailor/composite_observable_spec.rb +41 -0
- data/spec/tailor/configuration/style_spec.rb +197 -0
- data/spec/tailor/configuration_spec.rb +52 -33
- data/spec/tailor/critic_spec.rb +7 -8
- data/spec/tailor/formatter_spec.rb +52 -0
- data/spec/tailor/lexed_line_spec.rb +236 -88
- data/spec/tailor/lexer_spec.rb +8 -63
- data/spec/tailor/problem_spec.rb +14 -46
- data/spec/tailor/reporter_spec.rb +8 -8
- data/spec/tailor/ruler_spec.rb +1 -1
- data/spec/tailor/rulers/indentation_spaces_ruler/indentation_manager_spec.rb +132 -176
- data/spec/tailor/rulers/indentation_spaces_ruler_spec.rb +41 -33
- data/spec/tailor/rulers/{spaces_after_comma_spec.rb → spaces_after_comma_ruler_spec.rb} +5 -5
- data/spec/tailor/rulers/spaces_after_lbrace_ruler_spec.rb +14 -14
- data/spec/tailor/rulers/spaces_before_lbrace_ruler_spec.rb +1 -1
- data/spec/tailor/rulers/spaces_before_rbrace_ruler_spec.rb +1 -1
- data/spec/tailor/version_spec.rb +1 -1
- data/spec/tailor_spec.rb +3 -1
- data/tailor.gemspec +11 -3
- data/uest.rb +9 -0
- metadata +66 -41
- data/features/step_definitions/spacing/commas_steps.rb +0 -14
@@ -5,8 +5,8 @@ Feature: Indentation check on good files without trailing newlines
|
|
5
5
|
Given my configuration file ".tailor" looks like:
|
6
6
|
"""
|
7
7
|
Tailor.config do |config|
|
8
|
-
config.file_set do
|
9
|
-
trailing_newlines 0
|
8
|
+
config.file_set do |style|
|
9
|
+
style.trailing_newlines 0
|
10
10
|
end
|
11
11
|
end
|
12
12
|
"""
|
@@ -28,10 +28,12 @@ Feature: Indentation check on good files without trailing newlines
|
|
28
28
|
| indent/ok/one_line_subclass |
|
29
29
|
| indent/ok/one_line_subclass_with_inheritance |
|
30
30
|
|
31
|
+
@single_line
|
31
32
|
Scenarios: Good single-line statement uses
|
32
33
|
| File |
|
33
34
|
| indent/ok/class_singlestatement |
|
34
35
|
| indent/ok/require_class_singlestatement |
|
36
|
+
| indent/ok/class_as_symbol |
|
35
37
|
|
36
38
|
@multi_line
|
37
39
|
Scenarios: Good multi-line statement uses
|
@@ -51,11 +53,16 @@ Feature: Indentation check on good files without trailing newlines
|
|
51
53
|
| indent/ok/method_call_multistatement_trailing_comment |
|
52
54
|
| indent/ok/method_call_multistatement_lonely_paren |
|
53
55
|
| indent/ok/method_call_multistatement_lonely_paren_trailing_comment |
|
54
|
-
| indent/ok/rescue_ending_with_comma |
|
55
|
-
| indent/ok/rescue_ending_with_comma_trailing_comment |
|
56
56
|
| indent/ok/keyword_ending_with_period |
|
57
57
|
| indent/ok/keyword_ending_with_period_trailing_comment |
|
58
58
|
|
59
|
+
@multi_line @continuation
|
60
|
+
Scenarios: Good use of continuation keywords
|
61
|
+
| File |
|
62
|
+
| indent/ok/rescue_ending_with_comma |
|
63
|
+
| indent/ok/rescue_ending_with_comma_trailing_comment |
|
64
|
+
| indent/ok/def_rescue |
|
65
|
+
|
59
66
|
Scenarios: Good def uses
|
60
67
|
| File |
|
61
68
|
| indent/ok/def |
|
@@ -119,6 +126,7 @@ Feature: Indentation check on good files without trailing newlines
|
|
119
126
|
| indent/ok/multi_line_lonely_braces_as_t_string |
|
120
127
|
| indent/ok/multi_line_braces_embedded_arrays |
|
121
128
|
| indent/ok/braces_combo |
|
129
|
+
| indent/ok/deep_hash_with_rockets |
|
122
130
|
|
123
131
|
@single_line @brackets
|
124
132
|
Scenarios: Good single-line bracket uses
|
@@ -168,6 +176,7 @@ Feature: Indentation check on good files without trailing newlines
|
|
168
176
|
| indent/ok/multi_line_method_call |
|
169
177
|
| indent/ok/multi_line_method_call_ends_with_period |
|
170
178
|
| indent/ok/multi_line_method_call_ends_with_many_periods |
|
179
|
+
| indent/ok/method_lonely_args |
|
171
180
|
|
172
181
|
@multi_line @ops
|
173
182
|
Scenarios: Good multi-line if + logical operators
|
@@ -180,6 +189,7 @@ Feature: Indentation check on good files without trailing newlines
|
|
180
189
|
| indent/ok/multi_line_each_block |
|
181
190
|
| indent/ok/multi_line_each_block_with_op_and_parens |
|
182
191
|
| indent/ok/do_end_block_in_parens |
|
192
|
+
| indent/ok/block_in_block_ends_on_same_line |
|
183
193
|
|
184
194
|
@single_line @keywords
|
185
195
|
Scenarios: Good use of single-line keyword statements
|
@@ -195,12 +205,15 @@ Feature: Indentation check on good files without trailing newlines
|
|
195
205
|
| indent/ok/brace_bracket_paren_combo1 |
|
196
206
|
| indent/ok/paren_comma_combo1 |
|
197
207
|
|
208
|
+
@multi_line @labels
|
209
|
+
Scenarios: Use of labels
|
210
|
+
| File |
|
211
|
+
| indent/ok/line_ends_with_label |
|
212
|
+
|
198
213
|
@wip
|
199
214
|
Scenarios: WIPs
|
200
215
|
| File |
|
201
216
|
| indent/ok/case_whens_in |
|
202
217
|
| indent/ok/method_closing_lonely_paren |
|
203
|
-
| indent/ok/method_lonely_args |
|
204
|
-
| indent/ok/line_ends_with_label |
|
205
218
|
| indent/ok/rparen_and_do_same_line |
|
206
219
|
|
data/features/support/env.rb
CHANGED
@@ -88,6 +88,9 @@ H_SPACING_OK[:trailing_comma_with_trailing_comment] =
|
|
88
88
|
end}
|
89
89
|
|
90
90
|
H_SPACING_OK[:no_before_comma_in_array] = %Q{[1, 2]}
|
91
|
+
H_SPACING_OK[:line_ends_with_backslash] =
|
92
|
+
%Q{{ :thing => a_thing,\\
|
93
|
+
:thing2 => another_thing }}
|
91
94
|
|
92
95
|
#-------------------------------------------------------------------------------
|
93
96
|
# Braces
|
@@ -182,7 +185,7 @@ H_SPACING_1[:single_line_block_0_spaces_before_lbrace] =
|
|
182
185
|
%Q{1..10.times{ |n| puts n }}
|
183
186
|
|
184
187
|
H_SPACING_1[:two_line_braces_block_2_spaces_before_lbrace] =
|
185
|
-
%Q{1..10.times { |n|
|
188
|
+
%Q{1..10.times { |n|
|
186
189
|
puts n}}
|
187
190
|
|
188
191
|
H_SPACING_1[:two_line_braces_block_0_spaces_before_lbrace_trailing_comment] =
|
@@ -241,7 +244,7 @@ H_SPACING_2[:two_d_array_space_before_rbrackets] =
|
|
241
244
|
#-------------------------------------------------------------------------------
|
242
245
|
# Parens
|
243
246
|
#-------------------------------------------------------------------------------
|
244
|
-
H_SPACING_OK[:empty_parens] = %Q{def thing()}
|
247
|
+
H_SPACING_OK[:empty_parens] = %Q{def thing(); end}
|
245
248
|
H_SPACING_OK[:simple_method_call] = %Q{thing(one, two)}
|
246
249
|
H_SPACING_OK[:multi_line_method_call] = %Q{thing(one,
|
247
250
|
two)}
|
@@ -261,5 +264,3 @@ H_SPACING_1[:multi_line_method_call_space_after_lparen] = %Q{thing( one,
|
|
261
264
|
H_SPACING_1[:multi_line_method_call_space_after_lparen_trailing_comment] =
|
262
265
|
%Q{thing( one,
|
263
266
|
two)}
|
264
|
-
|
265
|
-
|
@@ -1,11 +1,11 @@
|
|
1
1
|
INDENT_OK = {}
|
2
2
|
|
3
|
-
INDENT_OK[:class] =
|
4
|
-
%Q{class MyClass
|
3
|
+
INDENT_OK[:class] =
|
4
|
+
%Q{class MyClass
|
5
5
|
end}
|
6
6
|
|
7
7
|
INDENT_OK[:one_line_class] =
|
8
|
-
%Q{class MyClass; end}
|
8
|
+
%Q{class MyClass; end}
|
9
9
|
|
10
10
|
INDENT_OK[:one_line_subclass] =
|
11
11
|
%Q{class MyClass < RuntimeError; end}
|
@@ -17,7 +17,7 @@ INDENT_OK[:one_line_subclass_with_inheritance] =
|
|
17
17
|
end}
|
18
18
|
|
19
19
|
INDENT_OK[:class_empty] =
|
20
|
-
%Q{class MyClass
|
20
|
+
%Q{class MyClass
|
21
21
|
|
22
22
|
end}
|
23
23
|
|
@@ -27,12 +27,12 @@ INDENT_OK[:class_empty_trailing_comment] =
|
|
27
27
|
end}
|
28
28
|
|
29
29
|
INDENT_OK[:class_singlestatement] =
|
30
|
-
%Q{class MyClass
|
30
|
+
%Q{class MyClass
|
31
31
|
include Stuff
|
32
32
|
end}
|
33
33
|
|
34
34
|
INDENT_OK[:assignment_addition_multistatement] =
|
35
|
-
%Q{thing = 1 +
|
35
|
+
%Q{thing = 1 +
|
36
36
|
2 + 3 + 4 +
|
37
37
|
5}
|
38
38
|
|
@@ -42,7 +42,7 @@ INDENT_OK[:assignment_addition_multistatement_trailing_comment] =
|
|
42
42
|
5}
|
43
43
|
|
44
44
|
INDENT_OK[:assignment_hash_multistatement] =
|
45
|
-
%Q{thing = {
|
45
|
+
%Q{thing = {
|
46
46
|
:one => 'one',
|
47
47
|
two: 'two'
|
48
48
|
}}
|
@@ -54,7 +54,7 @@ INDENT_OK[:assignment_hash_multistatement_trailing_comment] =
|
|
54
54
|
}}
|
55
55
|
|
56
56
|
INDENT_OK[:assignment_array_multistatement] =
|
57
|
-
%Q{thing = [
|
57
|
+
%Q{thing = [
|
58
58
|
:one,
|
59
59
|
:two
|
60
60
|
]}
|
@@ -78,10 +78,10 @@ INDENT_OK[:assignment_paren_multistatement_trailing_comment] =
|
|
78
78
|
5)}
|
79
79
|
|
80
80
|
INDENT_OK[:assignment_twolevel_hash_multistatement] =
|
81
|
-
%Q{thing = {
|
81
|
+
%Q{thing = {
|
82
82
|
:one => {
|
83
83
|
:a => 'a',
|
84
|
-
b:
|
84
|
+
b: 'b'
|
85
85
|
},
|
86
86
|
two: {
|
87
87
|
x: 'x',
|
@@ -90,7 +90,7 @@ INDENT_OK[:assignment_twolevel_hash_multistatement] =
|
|
90
90
|
}}
|
91
91
|
|
92
92
|
INDENT_OK[:assignment_twolevel_array_multistatement] =
|
93
|
-
%Q{thing = [
|
93
|
+
%Q{thing = [
|
94
94
|
[:one],
|
95
95
|
[
|
96
96
|
:two,
|
@@ -99,7 +99,7 @@ INDENT_OK[:assignment_twolevel_array_multistatement] =
|
|
99
99
|
]}
|
100
100
|
|
101
101
|
INDENT_OK[:assignment_twolevel_paren_multistatement] =
|
102
|
-
%Q{result = Integer(
|
102
|
+
%Q{result = Integer(
|
103
103
|
String.new(
|
104
104
|
"1"
|
105
105
|
).to_i,
|
@@ -107,7 +107,7 @@ INDENT_OK[:assignment_twolevel_paren_multistatement] =
|
|
107
107
|
)}
|
108
108
|
|
109
109
|
INDENT_OK[:method_call_multistatement] =
|
110
|
-
%Q{my_method_with_many_params(one, two,
|
110
|
+
%Q{my_method_with_many_params(one, two,
|
111
111
|
three,
|
112
112
|
four,
|
113
113
|
five)}
|
@@ -132,6 +132,9 @@ INDENT_OK[:method_call_multistatement_lonely_paren_trailing_comment] =
|
|
132
132
|
five
|
133
133
|
)}
|
134
134
|
|
135
|
+
#-------------------------------------------------------------------------------
|
136
|
+
# Continuation keywords
|
137
|
+
#-------------------------------------------------------------------------------
|
135
138
|
INDENT_OK[:rescue_ending_with_comma] =
|
136
139
|
%Q{begin
|
137
140
|
ssh.upload source, dest
|
@@ -154,6 +157,14 @@ rescue SocketError, ArgumentError, SystemCallError, # comment
|
|
154
157
|
"\#{ex.message}"
|
155
158
|
end}
|
156
159
|
|
160
|
+
INDENT_OK[:def_rescue] =
|
161
|
+
%Q{def some_method
|
162
|
+
do_something(one, two)
|
163
|
+
rescue => e
|
164
|
+
log "It didn't work."
|
165
|
+
raise e
|
166
|
+
end}
|
167
|
+
|
157
168
|
INDENT_OK[:keyword_ending_with_period] =
|
158
169
|
%Q{if [].
|
159
170
|
empty?
|
@@ -167,36 +178,46 @@ INDENT_OK[:keyword_ending_with_period_trailing_comment] =
|
|
167
178
|
end}
|
168
179
|
|
169
180
|
INDENT_OK[:def] =
|
170
|
-
%Q{def a_method
|
181
|
+
%Q{def a_method
|
171
182
|
end}
|
172
183
|
|
173
184
|
INDENT_OK[:def_empty] =
|
174
|
-
%Q{def a_method
|
185
|
+
%Q{def a_method
|
175
186
|
|
176
187
|
end}
|
177
188
|
|
178
189
|
INDENT_OK[:nested_def] =
|
179
|
-
%Q{def first_method
|
190
|
+
%Q{def first_method
|
180
191
|
def second_method
|
181
192
|
puts "hi"
|
182
193
|
end
|
183
194
|
end}
|
184
195
|
|
185
196
|
INDENT_OK[:nested_class] =
|
186
|
-
%Q{class MyClass
|
197
|
+
%Q{class MyClass
|
187
198
|
class AnotherClass
|
188
199
|
end
|
189
200
|
end}
|
190
201
|
|
191
202
|
INDENT_OK[:require_class_singlestatement] =
|
192
|
-
%Q{require 'time'
|
203
|
+
%Q{require 'time'
|
193
204
|
|
194
205
|
class MyClass
|
195
206
|
include Stuff
|
196
207
|
end}
|
197
208
|
|
209
|
+
INDENT_OK[:class_as_symbol] =
|
210
|
+
%Q{INDENT_OK = {}
|
211
|
+
|
212
|
+
INDENT_OK[:class] =
|
213
|
+
%Q{class MyClass
|
214
|
+
end}
|
215
|
+
|
216
|
+
INDENT_OK[:one_line_class] =
|
217
|
+
%Q{class MyClass; end}}
|
218
|
+
|
198
219
|
INDENT_OK[:require_class_singlestatement_def] =
|
199
|
-
%Q{require 'time'
|
220
|
+
%Q{require 'time'
|
200
221
|
|
201
222
|
class MyClass
|
202
223
|
include Stuff
|
@@ -206,7 +227,7 @@ class MyClass
|
|
206
227
|
end}
|
207
228
|
|
208
229
|
INDENT_OK[:require_class_singlestatement_def_content] =
|
209
|
-
%Q{require 'time'
|
230
|
+
%Q{require 'time'
|
210
231
|
|
211
232
|
class MyClass
|
212
233
|
include Stuff
|
@@ -217,21 +238,21 @@ class MyClass
|
|
217
238
|
end}
|
218
239
|
|
219
240
|
INDENT_OK[:if_modifier] =
|
220
|
-
%Q{puts "hi" if nil.nil?}
|
241
|
+
%Q{puts "hi" if nil.nil?}
|
221
242
|
|
222
243
|
INDENT_OK[:if_modifier2] =
|
223
244
|
%Q{start_key_registration_server if @profiles.values.include? :SM5000}
|
224
245
|
|
225
246
|
INDENT_OK[:def_return_if_modifier] =
|
226
|
-
%Q{def a_method
|
247
|
+
%Q{def a_method
|
227
248
|
return @something if @something
|
228
249
|
end}
|
229
250
|
|
230
251
|
INDENT_OK[:unless_modifier] =
|
231
|
-
%Q{puts "hi" unless nil.nil?}
|
252
|
+
%Q{puts "hi" unless nil.nil?}
|
232
253
|
|
233
254
|
INDENT_OK[:def_return_unless_modifier] =
|
234
|
-
%Q{def a_method
|
255
|
+
%Q{def a_method
|
235
256
|
return @something unless @something
|
236
257
|
end}
|
237
258
|
|
@@ -357,51 +378,65 @@ INDENT_OK[:for_with_retry_loop] =
|
|
357
378
|
end}
|
358
379
|
|
359
380
|
INDENT_OK[:loop_with_braces] =
|
360
|
-
%Q
|
381
|
+
%Q<loop {
|
361
382
|
puts 'stuff'
|
362
|
-
}
|
383
|
+
}>
|
363
384
|
|
364
385
|
#----------- Braces ----------#
|
365
386
|
INDENT_OK[:single_line_braces] =
|
366
|
-
%Q{
|
387
|
+
%Q<{ one: 1, two: 2 }>
|
367
388
|
|
368
389
|
INDENT_OK[:single_line_braces_as_t_string] =
|
369
|
-
%Q
|
390
|
+
%Q<%Q{this is a t string!}>
|
370
391
|
|
371
392
|
INDENT_OK[:multi_line_braces] =
|
372
|
-
%Q{
|
373
|
-
two: 2 }
|
393
|
+
%Q<{ one: 1,
|
394
|
+
two: 2 }>
|
374
395
|
|
375
396
|
INDENT_OK[:multi_line_braces_as_t_string] =
|
376
|
-
%Q
|
377
|
-
suckaaaaaa!}
|
397
|
+
%Q<%Q{this is a t string!
|
398
|
+
suckaaaaaa!}>
|
378
399
|
|
400
|
+
# For some reason, Ruby doesn't like '%Q<> here. Using [] instead.
|
379
401
|
INDENT_OK[:multi_line_lonely_braces] =
|
380
|
-
%Q{
|
402
|
+
%Q[{
|
381
403
|
:one => 'one', :two => 'two',
|
382
404
|
:three => 'three'
|
383
|
-
}
|
405
|
+
}]
|
384
406
|
|
385
407
|
INDENT_OK[:multi_line_lonely_braces_as_t_string] =
|
386
|
-
%Q
|
408
|
+
%Q<%Q{
|
387
409
|
this is a t string!
|
388
410
|
suckaaaaaa!
|
389
|
-
}
|
411
|
+
}>
|
390
412
|
|
391
413
|
INDENT_OK[:multi_line_braces_embedded_arrays] =
|
392
|
-
%Q{
|
414
|
+
%Q[{
|
393
415
|
:one => ['one', 17, {}], :two => ['two'],
|
394
416
|
:three => 'three'
|
395
|
-
}
|
417
|
+
}]
|
418
|
+
|
396
419
|
INDENT_OK[:braces_combo] =
|
397
|
-
%Q{
|
420
|
+
%Q<{ three: 3 }
|
398
421
|
{
|
399
422
|
three: 3 }
|
400
423
|
{ three: 3
|
401
424
|
}
|
402
425
|
{
|
403
426
|
three: 3
|
404
|
-
}
|
427
|
+
}>
|
428
|
+
|
429
|
+
INDENT_OK[:deep_hash_with_rockets] =
|
430
|
+
%Q[im_deep =
|
431
|
+
{ "one" =>
|
432
|
+
{ "1" =>
|
433
|
+
{ "a" => "A",
|
434
|
+
"b" => "B",
|
435
|
+
"c" => "C" },
|
436
|
+
"2" =>
|
437
|
+
{ "d" => "D",
|
438
|
+
"e" => "E",
|
439
|
+
"f" => "F" } } }]
|
405
440
|
|
406
441
|
#----------- Brackets ----------#
|
407
442
|
INDENT_OK[:single_line_brackets] =
|
@@ -631,6 +666,18 @@ INDENT_OK[:do_end_block_in_parens] =
|
|
631
666
|
rescue NoMethodError
|
632
667
|
end}
|
633
668
|
|
669
|
+
INDENT_OK[:block_in_block_ends_on_same_line] =
|
670
|
+
%Q{%w{
|
671
|
+
foo
|
672
|
+
bar
|
673
|
+
baz
|
674
|
+
}.each do |thing|
|
675
|
+
function thing do
|
676
|
+
puts "stuff"
|
677
|
+
end end
|
678
|
+
|
679
|
+
puts "post ends"}
|
680
|
+
|
634
681
|
INDENT_OK[:rparen_and_do_same_line] =
|
635
682
|
%Q{opt.on('-c', '--config-file FILE',
|
636
683
|
"Use a specific config file.") do |config|
|
@@ -663,7 +710,7 @@ INDENT_OK[:combo1] =
|
|
663
710
|
end}
|
664
711
|
|
665
712
|
INDENT_OK[:combo2] =
|
666
|
-
%Q{class C
|
713
|
+
%Q{class C
|
667
714
|
|
668
715
|
send :each do
|
669
716
|
def foo
|
@@ -675,8 +722,8 @@ end}
|
|
675
722
|
INDENT_OK[:combo3] =
|
676
723
|
%Q{def report_turducken(results, performance_results)
|
677
724
|
stuffing[:log_files] = { "\#{File.basename @logger.log_file_location}" =>
|
678
|
-
File.read(@logger.log_file_location).gsub(/(?<f><)(?<q
|
679
|
-
'
|
725
|
+
File.read(@logger.log_file_location).gsub(/(?<f><)(?<q>\\/)?(?<w>\\w)/,
|
726
|
+
'\\k<f>!\\k<q>\\k<w>') }.merge remote_logs
|
680
727
|
|
681
728
|
begin
|
682
729
|
Stuffer.login(@config[:turducken_server], @config[:turducken_username],
|
@@ -715,11 +762,11 @@ INDENT_OK[:line_ends_with_label] =
|
|
715
762
|
INDENT_1 = {}
|
716
763
|
|
717
764
|
INDENT_1[:class_indented_end] =
|
718
|
-
%Q{class MyClass
|
765
|
+
%Q{class MyClass
|
719
766
|
end}
|
720
767
|
|
721
768
|
INDENT_1[:class_indented_singlestatement] =
|
722
|
-
%Q{class MyClass
|
769
|
+
%Q{class MyClass
|
723
770
|
include Something
|
724
771
|
end}
|
725
772
|
|
@@ -729,42 +776,42 @@ INDENT_1[:class_indented_singlestatement_trailing_comment] =
|
|
729
776
|
end}
|
730
777
|
|
731
778
|
INDENT_1[:class_outdented_singlestatement] =
|
732
|
-
%Q{class MyClass
|
779
|
+
%Q{class MyClass
|
733
780
|
include Something
|
734
781
|
end}
|
735
782
|
|
736
783
|
INDENT_1[:def_indented_end] =
|
737
|
-
%Q{def a
|
784
|
+
%Q{def a
|
738
785
|
end}
|
739
786
|
|
740
787
|
INDENT_1[:def_content_indented_end] =
|
741
|
-
%Q{def a
|
788
|
+
%Q{def a
|
742
789
|
puts "stuff"
|
743
790
|
end}
|
744
791
|
|
745
792
|
INDENT_1[:class_def_content_outdented_end] =
|
746
|
-
%Q{class A
|
793
|
+
%Q{class A
|
747
794
|
def a
|
748
795
|
puts "stuff"
|
749
796
|
end
|
750
797
|
end}
|
751
798
|
|
752
799
|
INDENT_1[:class_def_outdented_content] =
|
753
|
-
%Q{class A
|
800
|
+
%Q{class A
|
754
801
|
def a
|
755
802
|
puts "stuff"
|
756
803
|
end
|
757
804
|
end}
|
758
805
|
|
759
806
|
INDENT_1[:class_method_def_using_self_outdented] =
|
760
|
-
%Q{class A
|
807
|
+
%Q{class A
|
761
808
|
self.my_method
|
762
809
|
puts 'stuff'
|
763
810
|
end
|
764
811
|
end}
|
765
812
|
|
766
813
|
INDENT_1[:case_indented_whens_level] =
|
767
|
-
%Q{def my_method
|
814
|
+
%Q{def my_method
|
768
815
|
case true
|
769
816
|
when true
|
770
817
|
puts "stuff"
|
@@ -784,7 +831,7 @@ INDENT_1[:case_indented_whens_level_trailing_comment] =
|
|
784
831
|
end}
|
785
832
|
|
786
833
|
INDENT_1[:case_outdented_whens_level] =
|
787
|
-
%Q{def my_method
|
834
|
+
%Q{def my_method
|
788
835
|
case true
|
789
836
|
when true
|
790
837
|
puts "stuff"
|
@@ -920,6 +967,11 @@ INDENT_1[:multi_line_string_first_line_indented_trailing_comment] =
|
|
920
967
|
end
|
921
968
|
end}
|
922
969
|
|
970
|
+
INDENT_1[:multi_line_tstring] =
|
971
|
+
%Q{INDENT_OK[:class] =
|
972
|
+
%Q{class MyClass
|
973
|
+
end}}
|
974
|
+
|
923
975
|
#-------------------------------------------------------------------------------
|
924
976
|
# Operators
|
925
977
|
#-------------------------------------------------------------------------------
|
@@ -969,4 +1021,3 @@ INDENT_1[:multi_line_method_call_ends_with_many_periods_last_in_trailing_comment
|
|
969
1021
|
%Q{my_hashie.first_level.
|
970
1022
|
second_level.
|
971
1023
|
third_level # comment}
|
972
|
-
|