tailor 1.0.1 → 1.1.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.
Files changed (69) hide show
  1. data/.tailor +1 -0
  2. data/Gemfile.lock +1 -1
  3. data/History.rdoc +34 -0
  4. data/README.rdoc +17 -1
  5. data/features/valid_ruby.feature +1 -1
  6. data/lib/ext/string_ext.rb +0 -4
  7. data/lib/tailor/cli/options.rb +9 -2
  8. data/lib/tailor/configuration.rb +103 -150
  9. data/lib/tailor/configuration/file_set.rb +110 -0
  10. data/lib/tailor/formatters/text.rb +108 -79
  11. data/lib/tailor/rake_task.rb +148 -0
  12. data/lib/tailor/tailorrc.erb +1 -1
  13. data/lib/tailor/version.rb +1 -1
  14. data/spec/functional/configuration_spec.rb +244 -0
  15. data/spec/functional/horizontal_spacing/braces_spec.rb +238 -0
  16. data/spec/functional/horizontal_spacing/brackets_spec.rb +88 -0
  17. data/spec/functional/horizontal_spacing/comma_spacing_spec.rb +68 -0
  18. data/spec/functional/horizontal_spacing/hard_tabs_spec.rb +110 -0
  19. data/spec/functional/horizontal_spacing/long_lines_spec.rb +51 -0
  20. data/spec/functional/horizontal_spacing/parens_spec.rb +102 -0
  21. data/spec/functional/horizontal_spacing/trailing_whitespace_spec.rb +66 -0
  22. data/spec/functional/horizontal_spacing_spec.rb +59 -0
  23. data/spec/functional/indentation_spacing/bad_indentation_spec.rb +372 -0
  24. data/spec/functional/indentation_spacing_spec.rb +85 -0
  25. data/spec/functional/naming/camel_case_methods_spec.rb +56 -0
  26. data/spec/functional/naming/screaming_snake_case_classes_spec.rb +83 -0
  27. data/spec/functional/naming_spec.rb +35 -0
  28. data/spec/functional/vertical_spacing/class_length_spec.rb +67 -0
  29. data/spec/functional/vertical_spacing/method_length_spec.rb +61 -0
  30. data/spec/functional/vertical_spacing_spec.rb +35 -0
  31. data/spec/support/bad_indentation_cases.rb +265 -0
  32. data/{features/support/file_cases/indentation_cases.rb → spec/support/good_indentation_cases.rb} +6 -266
  33. data/spec/support/horizontal_spacing_cases.rb +136 -0
  34. data/spec/support/naming_cases.rb +26 -0
  35. data/{features/support/file_cases → spec/support}/vertical_spacing_cases.rb +0 -33
  36. data/spec/{tailor → unit/tailor}/cli_spec.rb +1 -1
  37. data/spec/{tailor → unit/tailor}/composite_observable_spec.rb +1 -1
  38. data/spec/unit/tailor/configuration/file_set_spec.rb +65 -0
  39. data/spec/{tailor → unit/tailor}/configuration/style_spec.rb +1 -1
  40. data/spec/{tailor → unit/tailor}/configuration_spec.rb +1 -59
  41. data/spec/{tailor → unit/tailor}/critic_spec.rb +1 -1
  42. data/spec/{tailor → unit/tailor}/formatter_spec.rb +1 -1
  43. data/spec/{tailor → unit/tailor}/lexed_line_spec.rb +1 -1
  44. data/spec/{tailor → unit/tailor}/lexer/token_spec.rb +1 -1
  45. data/spec/{tailor → unit/tailor}/lexer_spec.rb +1 -2
  46. data/spec/{tailor → unit/tailor}/options_spec.rb +1 -1
  47. data/spec/{tailor → unit/tailor}/problem_spec.rb +1 -1
  48. data/spec/{tailor → unit/tailor}/reporter_spec.rb +1 -1
  49. data/spec/{tailor → unit/tailor}/ruler_spec.rb +1 -1
  50. data/spec/{tailor → unit/tailor}/rulers/indentation_spaces_ruler/indentation_manager_spec.rb +1 -1
  51. data/spec/{tailor → unit/tailor}/rulers/indentation_spaces_ruler_spec.rb +1 -1
  52. data/spec/{tailor → unit/tailor}/rulers/spaces_after_comma_ruler_spec.rb +1 -1
  53. data/spec/{tailor → unit/tailor}/rulers/spaces_after_lbrace_ruler_spec.rb +1 -1
  54. data/spec/{tailor → unit/tailor}/rulers/spaces_before_lbrace_ruler_spec.rb +1 -1
  55. data/spec/{tailor → unit/tailor}/rulers/spaces_before_rbrace_ruler_spec.rb +1 -1
  56. data/spec/{tailor → unit/tailor}/rulers_spec.rb +1 -1
  57. data/spec/unit/tailor/version_spec.rb +6 -0
  58. data/spec/{tailor_spec.rb → unit/tailor_spec.rb} +1 -1
  59. data/tasks/spec.rake +8 -3
  60. metadata +121 -93
  61. data/features/horizontal_spacing.feature +0 -263
  62. data/features/indentation/bad_files_with_no_trailing_newline.feature +0 -91
  63. data/features/indentation/good_files_with_no_trailing_newline.feature +0 -219
  64. data/features/name_detection.feature +0 -72
  65. data/features/support/file_cases/horizontal_spacing_cases.rb +0 -266
  66. data/features/support/file_cases/naming_cases.rb +0 -51
  67. data/features/vertical_spacing.feature +0 -135
  68. data/m.rb +0 -15
  69. data/spec/tailor/version_spec.rb +0 -6
@@ -1,72 +0,0 @@
1
- Feature: Name detection
2
- As a Ruby developer, I want to be able to detect improper class and method
3
- names so that I can fix them.
4
-
5
- Background:
6
- Given my configuration file ".tailor" looks like:
7
- """
8
- Tailor.config do |config|
9
- config.file_set do |style|
10
- style.trailing_newlines 0
11
- end
12
- end
13
- """
14
-
15
- @method_naming @good_files
16
- Scenario Outline: Method naming
17
- Given <File> exists without a newline at the end
18
- When I run `tailor -d -c .tailor <File>`
19
- Then the output should match /Total Problems.*0/
20
- And the exit status should be 0
21
-
22
- Scenarios: Good method naming
23
- | File |
24
- | naming/ok/single_word_method |
25
- | naming/ok/two_word_method |
26
-
27
- @method_naming @bad_files
28
-
29
- Scenario Outline: Bad method naming
30
- Given <File> exists without a newline at the end
31
- When I run `tailor -d -c .tailor <File>`
32
- Then the output should match /Total Problems.*<Count>/
33
- And the output should match /position: <Position>/
34
- And the exit status should be 1
35
-
36
- Scenarios: Bad method naming
37
- | File | Count | Position |
38
- | naming/1/one_caps_camel_case_method | 1 | 1:4 |
39
- | naming/1/one_caps_camel_case_method_trailing_comment | 1 | 1:4 |
40
-
41
- @class_naming @good_files
42
-
43
- Scenario Outline: Good class naming
44
- Given <File> exists without a newline at the end
45
- When I run `tailor -d -c .tailor <File>`
46
- Then the output should match /Total Problems.*0/
47
- And the exit status should be 0
48
-
49
- Scenarios: Good class/module naming
50
- | File |
51
- | naming/ok/single_word_class |
52
- | naming/ok/single_word_module |
53
- | naming/ok/two_word_class |
54
- | naming/ok/two_word_module |
55
-
56
- @class_naming @bad_files
57
-
58
- Scenario Outline: Bad class/module naming
59
- Given <File> exists without a newline at the end
60
- When I run `tailor -d -c .tailor <File>`
61
- Then the output should match /Total Problems.*<Count>/
62
- And the output should match /position: <Position>/
63
- And the exit status should be 1
64
-
65
- Scenarios: Bad method naming
66
- | File | Count | Position |
67
- | naming/1/one_screaming_snake_case_class | 1 | 1:6 |
68
- | naming/1/one_screaming_snake_module_class | 1 | 1:7 |
69
- | naming/1/two_screaming_snake_case_class | 1 | 1:6 |
70
- | naming/1/two_screaming_snake_module_class | 1 | 1:7 |
71
-
72
-
@@ -1,266 +0,0 @@
1
- H_SPACING_OK = {}
2
- H_SPACING_1 = {}
3
- H_SPACING_2 = {}
4
-
5
- H_SPACING_OK[:short_line_no_newline] = %Q{'#{'#' * 78}'}
6
- H_SPACING_OK[:short_line_newline_at_81] =
7
- %Q{'#{'#' * 78}'
8
- }
9
-
10
- #-------------------------------------------------------------------------------
11
- # Hard tabs
12
- #-------------------------------------------------------------------------------
13
- H_SPACING_1[:hard_tab] =
14
- %Q{def something
15
- \tputs "something"
16
- end}
17
-
18
- H_SPACING_1[:hard_tab_with_spaces] =
19
- %Q{class Thing
20
- def something
21
- \t puts "something"
22
- end
23
- end}
24
-
25
- # This only reports the hard tab problem (and not the indentation problem)
26
- # because a hard tab is counted as 1 space; here, this is 4 spaces, so it
27
- # looks correct to the parser. I'm leaving this behavior, as detecting the
28
- # hard tab should signal the problem. If you fix the hard tab and don't
29
- # fix indentation, tailor will flag you on the indentation on the next run.
30
- H_SPACING_1[:hard_tab_with_1_indented_space] =
31
- %Q{class Thing
32
- def something
33
- \t puts "something"
34
- end
35
- end}
36
-
37
- H_SPACING_2[:hard_tab_with_2_indented_spaces] =
38
- %Q{class Thing
39
- def something
40
- \t puts "something"
41
- end
42
- end}
43
-
44
- #-------------------------------------------------------------------------------
45
- # Long lines
46
- #-------------------------------------------------------------------------------
47
- H_SPACING_1[:long_line_no_newline] = %Q{'#{'#' * 79}'}
48
- H_SPACING_1[:long_line_newline_at_82] =%Q{'#{'#' * 79}'
49
- }
50
-
51
- #-------------------------------------------------------------------------------
52
- # Trailing whitespace
53
- #-------------------------------------------------------------------------------
54
- H_SPACING_1[:empty_line_with_spaces] = %Q{ }
55
- H_SPACING_1[:empty_line_with_spaces_in_method] = %Q{def thing
56
-
57
- puts 'something'
58
- end}
59
-
60
- H_SPACING_1[:trailing_spaces_on_def] = %Q{def thing
61
- puts 'something'
62
- end}
63
-
64
- #-------------------------------------------------------------------------------
65
- # Comma spacing
66
- #-------------------------------------------------------------------------------
67
- H_SPACING_1[:no_space_after_comma] = %Q{[1,2]}
68
- H_SPACING_1[:two_spaces_after_comma] = %Q{[1, 2]}
69
- H_SPACING_1[:one_space_before_comma] = %Q{[1 ,2]}
70
- H_SPACING_1[:two_spaces_before_comma] = %Q{[1 , 2]}
71
- H_SPACING_2[:two_spaces_before_comma_twice] = %Q{[1 , 2 , 3]}
72
- H_SPACING_2[:two_spaces_after_comma_twice] = %Q{[1, 2, 3]}
73
-
74
- H_SPACING_2[:spaces_before_with_trailing_comments] = %Q{[
75
- 1 , # Comment!
76
- 2 , # Another comment.
77
- }
78
-
79
- H_SPACING_OK[:space_after_comma_in_array] = %Q{[1, 2]}
80
-
81
- H_SPACING_OK[:trailing_comma] = %Q{def thing(one, two,
82
- three)
83
- end}
84
-
85
- H_SPACING_OK[:trailing_comma_with_trailing_comment] =
86
- %Q{def thing(one, two, # Comment!
87
- three)
88
- end}
89
-
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 }}
94
-
95
- #-------------------------------------------------------------------------------
96
- # Braces
97
- #-------------------------------------------------------------------------------
98
- H_SPACING_OK[:empty_hash] = %Q{{}}
99
- H_SPACING_OK[:single_line_hash] = %Q{{ :one => 'one' }}
100
- H_SPACING_OK[:single_line_hash_lonely_braces] = %Q{{
101
- :one => 'one'
102
- }}
103
-
104
- H_SPACING_OK[:hash_as_param_in_parens] =
105
- %Q{add_headers({ content_length: new_body.length })}
106
-
107
- H_SPACING_OK[:two_line_hash] = %Q{{ :one =>
108
- 'one' }}
109
-
110
- H_SPACING_OK[:two_line_hash_trailing_comment] = %Q{{ :one => # comment
111
- 'one' }}
112
-
113
- H_SPACING_OK[:three_line_hash] = %Q{{ :one =>
114
- 'one', :two =>
115
- 'two' }}
116
-
117
- H_SPACING_OK[:single_line_block] = %Q{1..10.times { |n| puts number }}
118
- H_SPACING_OK[:multi_line_braces_block] = %Q{1..10.times { |n|
119
- puts number }}
120
-
121
- H_SPACING_OK[:multi_line_qword_using_braces] = %Q{%w{
122
- foo
123
- bar
124
- baz
125
- }.each do |whatevs|
126
- bla
127
- end}
128
-
129
- H_SPACING_OK[:empty_hash_in_multi_line_statement] =
130
- %Q{if true
131
- {}
132
- end}
133
-
134
- H_SPACING_OK[:multi_line_hash_in_multi_line_statement] =
135
- %Q{if true
136
- options = {
137
- one: 1
138
- }
139
- end}
140
-
141
- H_SPACING_OK[:single_line_string_interp] = %Q{`\#{IFCONFIG} | grep \#{ip}`}
142
- H_SPACING_OK[:single_line_block_in_string_interp] =
143
- %Q{"I did this \#{1..10.times { |n| n }} times."}
144
-
145
- H_SPACING_OK[:empty_hash_in_string_in_block] =
146
- %Q{[1].map { |n| { :first => "\#{n}-\#{{}}" } }}
147
-
148
- H_SPACING_OK[:string_interp_with_colonop] =
149
- %Q{"\#{::Rails.root}"}
150
-
151
- H_SPACING_1[:single_line_hash_2_spaces_before_lbrace] =
152
- %Q{thing = { :one => 'one' }}
153
-
154
- H_SPACING_1[:single_line_hash_2_spaces_before_rbrace] =
155
- %Q{thing = { :one => 'one' }}
156
-
157
- H_SPACING_1[:single_line_hash_2_spaces_after_lbrace] =
158
- %Q{thing = { :one => 'one' }}
159
-
160
- H_SPACING_1[:single_line_hash_0_spaces_before_lbrace] =
161
- %Q{thing ={ :one => 'one' }}
162
-
163
- H_SPACING_1[:two_line_hash_2_spaces_before_lbrace] = %Q{thing1 =
164
- thing2 = { :one => 'one' }}
165
-
166
- H_SPACING_1[:two_line_hash_2_spaces_before_rbrace] = %Q{thing1 =
167
- thing2 = { :one => 'one' }}
168
-
169
- H_SPACING_1[:two_line_hash_2_spaces_before_lbrace_lonely_braces] =
170
- %Q{thing1 =
171
- thing2 = {
172
- :one => 'one'
173
- }}
174
-
175
- H_SPACING_1[:space_in_empty_hash_in_string_in_block] =
176
- %Q{[1].map { |n| { :first => "\#{n}-\#{{ }}" } }}
177
-
178
- H_SPACING_1[:single_line_block_2_spaces_before_lbrace] =
179
- %Q{1..10.times { |n| puts n }}
180
-
181
- H_SPACING_1[:single_line_block_in_string_interp_2_spaces_before_lbrace] =
182
- %Q{"I did this \#{1..10.times { |n| puts n }} times."}
183
-
184
- H_SPACING_1[:single_line_block_0_spaces_before_lbrace] =
185
- %Q{1..10.times{ |n| puts n }}
186
-
187
- H_SPACING_1[:two_line_braces_block_2_spaces_before_lbrace] =
188
- %Q{1..10.times { |n|
189
- puts n}}
190
-
191
- H_SPACING_1[:two_line_braces_block_0_spaces_before_lbrace_trailing_comment] =
192
- %Q{1..10.times{ |n| # comment
193
- puts n}}
194
-
195
- H_SPACING_2[:no_space_after_l_before_r_after_string_interp] =
196
- %Q{logger.debug "Upgrading from \#{current_version} to \#{new_version}", {:format => :short}}
197
-
198
- H_SPACING_2[:no_space_before_consecutive_rbraces] =
199
- %Q{thing = { 'id' => "\#{source}", 'attributes' => { 'height' => "\#{height}"}}}
200
-
201
- #-------------------------------------------------------------------------------
202
- # Brackets
203
- #-------------------------------------------------------------------------------
204
- H_SPACING_OK[:empty_array] = %Q{[]}
205
- H_SPACING_OK[:simple_array] = %Q{[1, 2, 3]}
206
- H_SPACING_OK[:two_d_array] = %Q{[[1, 2, 3], ['a', 'b', 'c']]}
207
- H_SPACING_OK[:hash_key_reference] = %Q{thing[:one]}
208
- H_SPACING_OK[:array_of_symbols] =
209
- %Q{transition [:active, :reactivated] => :opened}
210
- H_SPACING_OK[:array_of_hashes] =
211
- %Q{[ { :one => [[1, 2, 3], ['a', 'b', 'c']] },
212
- { :two => [[4, 5, 6], ['d', 'e', 'f']] }]}
213
-
214
- H_SPACING_OK[:simple_array_lonely_brackets] =
215
- %Q{[
216
- 1, 2,
217
- 3
218
- ]}
219
-
220
- H_SPACING_OK[:simple_nested_array_lonely_brackets] =
221
- %Q{def thing
222
- [
223
- 1, 2,
224
- 3
225
- ]
226
- end}
227
-
228
-
229
- H_SPACING_OK[:empty_array_in_multi_line_statement] =
230
- %Q{if true
231
- []
232
- end}
233
-
234
- H_SPACING_1[:space_in_empty_array] = %Q{[ ]}
235
- H_SPACING_1[:simple_array_space_after_lbracket] = %Q{[ 1, 2, 3]}
236
- H_SPACING_1[:simple_array_space_before_rbracket] = %Q{[1, 2, 3 ]}
237
- H_SPACING_1[:hash_key_ref_space_before_rbracket] = %Q{thing[:one ]}
238
- H_SPACING_1[:hash_key_ref_space_after_lbracket] = %Q{thing[ :one]}
239
- H_SPACING_2[:two_d_array_space_after_lbrackets] =
240
- %Q{[ [1, 2, 3], [ 'a', 'b', 'c']]}
241
- H_SPACING_2[:two_d_array_space_before_rbrackets] =
242
- %Q{[[1, 2, 3 ], [ 'a', 'b', 'c'] ]}
243
-
244
- #-------------------------------------------------------------------------------
245
- # Parens
246
- #-------------------------------------------------------------------------------
247
- H_SPACING_OK[:empty_parens] = %Q{def thing(); end}
248
- H_SPACING_OK[:simple_method_call] = %Q{thing(one, two)}
249
- H_SPACING_OK[:multi_line_method_call] = %Q{thing(one,
250
- two)}
251
- H_SPACING_OK[:multi_line_method_call_lonely_parens] = %Q{thing(
252
- one, two
253
- )}
254
-
255
- H_SPACING_1[:simple_method_call_space_after_lparen] = %Q{thing( one, two)}
256
- H_SPACING_1[:simple_method_call_space_before_rparen] = %Q{thing(one, two )}
257
- H_SPACING_1[:method_call_space_after_lparen_trailing_comment] =
258
- %Q{thing( one, two) # comment}
259
- H_SPACING_2[:method_call_space_after_lparen_before_rparen_trailing_comment] =
260
- %Q{thing( one, two ) # comment}
261
-
262
- H_SPACING_1[:multi_line_method_call_space_after_lparen] = %Q{thing( one,
263
- two)}
264
- H_SPACING_1[:multi_line_method_call_space_after_lparen_trailing_comment] =
265
- %Q{thing( one,
266
- two)}
@@ -1,51 +0,0 @@
1
- NAMING_OK = {}
2
- NAMING_1 = {}
3
-
4
- NAMING_OK[:single_word_method] =
5
- %Q{def thing
6
- end}
7
-
8
- NAMING_OK[:two_word_method] =
9
- %Q{def thing_one
10
- end}
11
-
12
- NAMING_1[:one_caps_camel_case_method] =
13
- %Q{def thingOne
14
- end}
15
-
16
- NAMING_1[:one_caps_camel_case_method_trailing_comment] =
17
- %Q{def thingOne # comment
18
- end}
19
-
20
- #-------------------------------------------------------------------------------
21
- NAMING_OK[:single_word_class] =
22
- %Q{class Thing
23
- end}
24
-
25
- NAMING_OK[:single_word_module] =
26
- %Q{module Thing
27
- end}
28
-
29
- NAMING_OK[:two_word_class] =
30
- %Q{class ThingOne
31
- end}
32
-
33
- NAMING_OK[:two_word_module] =
34
- %Q{module ThingOne
35
- end}
36
-
37
- NAMING_1[:one_screaming_snake_case_class] =
38
- %Q{class Thing_One
39
- end}
40
-
41
- NAMING_1[:one_screaming_snake_module_class] =
42
- %Q{module Thing_One
43
- end}
44
-
45
- NAMING_1[:two_screaming_snake_case_class] =
46
- %Q{class Thing_One_Again
47
- end}
48
-
49
- NAMING_1[:two_screaming_snake_module_class] =
50
- %Q{module Thing_One_Again
51
- end}
@@ -1,135 +0,0 @@
1
- Feature: Vertical spacing
2
- As a Ruby developer
3
- I want to check my Ruby files for vertical spacing
4
-
5
- @bad_files
6
- Scenario: Detect lack of newlines
7
- Given a file named "not_enough_newlines.rb" with:
8
- """
9
- def a_method
10
- puts 'hi'
11
- end
12
- """
13
- When I run `tailor -d .`
14
- Then the output should match /Total Problems.*1/
15
- And the output should contain "0 trailing newlines, but should have 1"
16
-
17
- @bad_files
18
- Scenario: Detect too many newlines
19
- Given a file named "too_many_newlines.rb" with:
20
- """
21
- def a_method
22
- puts 'hi'
23
- end
24
-
25
-
26
- """
27
- When I run `tailor -d .`
28
- Then the output should match /Total Problems.*1/
29
- And the output should contain "2 trailing newlines, but should have 1"
30
-
31
- @good_files
32
- Scenario: Doesn't report problem when meeting criteria
33
- Given a file named "good_file.rb" with:
34
- """
35
- def a_method
36
- puts 'hi'
37
- end
38
-
39
- """
40
- When I run `tailor -d .`
41
- Then the output should match /Total Problems.*0/
42
-
43
- @multi_line @good_files
44
-
45
- @class_length
46
- Scenario Outline: Classes/modules with <= configured lines
47
- Given my configuration file ".tailor" looks like:
48
- """
49
- Tailor.config do |config|
50
- config.file_set do |style|
51
- style.max_code_lines_in_class 5
52
- style.trailing_newlines 0
53
- end
54
- end
55
- """
56
- And <File> exists without a newline at the end
57
- When I run `tailor -d -c .tailor <File>`
58
- Then the output should match /Total Problems.*0/
59
- And the exit status should be 0
60
-
61
- Scenarios:
62
- | File |
63
- | v_spacing/ok/class_five_code_lines |
64
- | v_spacing/ok/embedded_class_five_code_lines |
65
-
66
- @bad_files @class_length
67
-
68
- @multi_line
69
- Scenario Outline: Lines with bad spacing around parens
70
- Given my configuration file ".tailor" looks like:
71
- """
72
- Tailor.config do |config|
73
- config.file_set do |style|
74
- style.max_code_lines_in_class 5
75
- end
76
- end
77
- """
78
- And <File> exists without a newline at the end
79
- When I run `tailor -d -c .tailor <File>`
80
- Then the output should match /Total Problems.*<Problems>/
81
- And the output should match /position: <Position>/
82
- And the output should match /position: <Position 2>/
83
- And the exit status should be 1
84
-
85
- Scenarios:
86
- | File | Position | Position 2 | Problems |
87
- | v_spacing/1/class_too_long | 1:0 | | 1 |
88
- | v_spacing/1/parent_class_too_long | 1:0 | | 1 |
89
-
90
- @good_files @method_length
91
-
92
- @multi_line
93
- Scenario Outline: Methods with <= configured lines
94
- Given my configuration file ".tailor" looks like:
95
- """
96
- Tailor.config do |config|
97
- config.file_set do |style|
98
- style.max_code_lines_in_method 3
99
- style.trailing_newlines 0
100
- end
101
- end
102
- """
103
- And <File> exists without a newline at the end
104
- When I run `tailor -d -c .tailor <File>`
105
- Then the output should match /Total Problems.*0/
106
- And the exit status should be 0
107
-
108
- Scenarios:
109
- | File |
110
- | v_spacing/ok/method_3_code_lines |
111
- | v_spacing/ok/embedded_method_3_code_lines |
112
-
113
- @bad_files @method_length
114
-
115
- @multi_line
116
- Scenario Outline: Lines with bad spacing around parens
117
- Given my configuration file ".tailor" looks like:
118
- """
119
- Tailor.config do |config|
120
- config.file_set do |style|
121
- style.max_code_lines_in_method 3
122
- end
123
- end
124
- """
125
- And <File> exists without a newline at the end
126
- When I run `tailor -d -c .tailor <File>`
127
- Then the output should match /Total Problems.*<Problems>/
128
- And the output should match /position: <Position>/
129
- And the output should match /position: <Position 2>/
130
- And the exit status should be 1
131
-
132
- Scenarios:
133
- | File | Position | Position 2 | Problems |
134
- | v_spacing/1/method_too_long | 1:0 | | 1 |
135
- | v_spacing/1/parent_method_too_long | 1:0 | | 1 |