tailor 1.1.5 → 1.2.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 (54) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +1 -0
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +23 -23
  6. data/History.rdoc +14 -0
  7. data/README.rdoc +42 -2
  8. data/Rakefile +7 -0
  9. data/features/continuous_integration.feature +28 -0
  10. data/lib/tailor/cli.rb +17 -4
  11. data/lib/tailor/cli/options.rb +6 -0
  12. data/lib/tailor/configuration.rb +19 -3
  13. data/lib/tailor/configuration/style.rb +7 -0
  14. data/lib/tailor/critic.rb +4 -2
  15. data/lib/tailor/formatters/yaml.rb +51 -0
  16. data/lib/tailor/lexer.rb +6 -4
  17. data/lib/tailor/rake_task.rb +44 -6
  18. data/lib/tailor/reporter.rb +9 -3
  19. data/lib/tailor/rulers/allow_invalid_ruby_ruler.rb +3 -3
  20. data/lib/tailor/rulers/indentation_spaces_ruler.rb +24 -6
  21. data/lib/tailor/rulers/indentation_spaces_ruler/indentation_manager.rb +2 -2
  22. data/lib/tailor/rulers/spaces_before_rbrace_ruler.rb +9 -6
  23. data/lib/tailor/rulers/spaces_in_empty_braces_ruler.rb +1 -1
  24. data/lib/tailor/version.rb +1 -1
  25. data/spec/functional/configuration_spec.rb +37 -0
  26. data/spec/functional/horizontal_spacing/braces_spec.rb +113 -113
  27. data/spec/functional/horizontal_spacing/brackets_spec.rb +39 -39
  28. data/spec/functional/horizontal_spacing/comma_spacing_spec.rb +27 -27
  29. data/spec/functional/horizontal_spacing/hard_tabs_spec.rb +42 -42
  30. data/spec/functional/horizontal_spacing/long_lines_spec.rb +16 -16
  31. data/spec/functional/horizontal_spacing/parens_spec.rb +48 -48
  32. data/spec/functional/horizontal_spacing/trailing_whitespace_spec.rb +23 -23
  33. data/spec/functional/horizontal_spacing_spec.rb +11 -11
  34. data/spec/functional/indentation_spacing/bad_indentation_spec.rb +212 -215
  35. data/spec/functional/indentation_spacing_spec.rb +8 -7
  36. data/spec/functional/naming/camel_case_methods_spec.rb +16 -16
  37. data/spec/functional/naming/screaming_snake_case_classes_spec.rb +30 -30
  38. data/spec/functional/naming_spec.rb +5 -4
  39. data/spec/functional/rake_task_spec.rb +56 -10
  40. data/spec/functional/vertical_spacing/class_length_spec.rb +16 -16
  41. data/spec/functional/vertical_spacing/method_length_spec.rb +16 -16
  42. data/spec/functional/vertical_spacing_spec.rb +5 -4
  43. data/spec/support/bad_indentation_cases.rb +35 -35
  44. data/spec/support/good_indentation_cases.rb +108 -108
  45. data/spec/support/horizontal_spacing_cases.rb +37 -37
  46. data/spec/support/naming_cases.rb +6 -6
  47. data/spec/support/vertical_spacing_cases.rb +4 -4
  48. data/spec/unit/tailor/cli_spec.rb +34 -12
  49. data/spec/unit/tailor/configuration_spec.rb +18 -0
  50. data/spec/unit/tailor/formatters/yaml_spec.rb +75 -0
  51. data/spec/unit/tailor/reporter_spec.rb +23 -4
  52. data/spec/unit/tailor/rulers/indentation_spaces_ruler_spec.rb +12 -10
  53. data/spec/unit/tailor/version_spec.rb +3 -2
  54. metadata +35 -63
@@ -3,6 +3,7 @@ require_relative '../support/vertical_spacing_cases'
3
3
  require 'tailor/critic'
4
4
  require 'tailor/configuration/style'
5
5
 
6
+
6
7
  describe "Vertical Space problem detection" do
7
8
  before do
8
9
  Tailor::Logger.stub(:log)
@@ -23,13 +24,13 @@ describe "Vertical Space problem detection" do
23
24
 
24
25
  V_SPACING_OK.each do |file_name, contents|
25
26
  before do
26
- FileUtils.touch file_name.to_s
27
- File.open(file_name.to_s, 'w') { |f| f.write contents }
27
+ FileUtils.touch file_name
28
+ File.open(file_name, 'w') { |f| f.write contents }
28
29
  end
29
30
 
30
31
  it "should be OK" do
31
- critic.check_file(file_name.to_s, style.to_hash)
32
- critic.problems.should == { file_name.to_s => [] }
32
+ critic.check_file(file_name, style.to_hash)
33
+ critic.problems.should == { file_name => [] }
33
34
  end
34
35
  end
35
36
  end
@@ -3,56 +3,56 @@
3
3
  #-------------------------------------------------------------------------------
4
4
  INDENT_1 = {}
5
5
 
6
- INDENT_1[:class_indented_end] =
6
+ INDENT_1['class_indented_end'] =
7
7
  %Q{class MyClass
8
8
  end}
9
9
 
10
- INDENT_1[:class_indented_single_statement] =
10
+ INDENT_1['class_indented_single_statement'] =
11
11
  %Q{class MyClass
12
12
  include Something
13
13
  end}
14
14
 
15
- INDENT_1[:class_indented_single_statement_trailing_comment] =
15
+ INDENT_1['class_indented_single_statement_trailing_comment'] =
16
16
  %Q{class MyClass
17
17
  include Something # comment
18
18
  end}
19
19
 
20
- INDENT_1[:class_outdented_single_statement] =
20
+ INDENT_1['class_outdented_single_statement'] =
21
21
  %Q{class MyClass
22
22
  include Something
23
23
  end}
24
24
 
25
- INDENT_1[:def_indented_end] =
25
+ INDENT_1['def_indented_end'] =
26
26
  %Q{def a
27
27
  end}
28
28
 
29
- INDENT_1[:def_content_indented_end] =
29
+ INDENT_1['def_content_indented_end'] =
30
30
  %Q{def a
31
31
  puts "stuff"
32
32
  end}
33
33
 
34
- INDENT_1[:class_def_content_outdented_end] =
34
+ INDENT_1['class_def_content_outdented_end'] =
35
35
  %Q{class A
36
36
  def a
37
37
  puts "stuff"
38
38
  end
39
39
  end}
40
40
 
41
- INDENT_1[:class_def_outdented_content] =
41
+ INDENT_1['class_def_outdented_content'] =
42
42
  %Q{class A
43
43
  def a
44
44
  puts "stuff"
45
45
  end
46
46
  end}
47
47
 
48
- INDENT_1[:class_method_def_using_self_outdented] =
48
+ INDENT_1['class_method_def_using_self_outdented'] =
49
49
  %Q{class A
50
50
  def self.my_method
51
51
  puts 'stuff'
52
52
  end
53
53
  end}
54
54
 
55
- INDENT_1[:case_indented_whens_level] =
55
+ INDENT_1['case_indented_whens_level'] =
56
56
  %Q{def my_method
57
57
  case true
58
58
  when true
@@ -62,7 +62,7 @@ INDENT_1[:case_indented_whens_level] =
62
62
  end
63
63
  end}
64
64
 
65
- INDENT_1[:case_indented_whens_level_trailing_comment] =
65
+ INDENT_1['case_indented_whens_level_trailing_comment'] =
66
66
  %Q{def my_method
67
67
  case true # comment
68
68
  when true
@@ -72,7 +72,7 @@ INDENT_1[:case_indented_whens_level_trailing_comment] =
72
72
  end
73
73
  end}
74
74
 
75
- INDENT_1[:case_outdented_whens_level] =
75
+ INDENT_1['case_outdented_whens_level'] =
76
76
  %Q{def my_method
77
77
  case true
78
78
  when true
@@ -82,7 +82,7 @@ INDENT_1[:case_outdented_whens_level] =
82
82
  end
83
83
  end}
84
84
 
85
- INDENT_1[:case_when_indented_whens_level] =
85
+ INDENT_1['case_when_indented_whens_level'] =
86
86
  %Q{def my_method
87
87
  case true
88
88
  when true
@@ -92,7 +92,7 @@ INDENT_1[:case_when_indented_whens_level] =
92
92
  end
93
93
  end}
94
94
 
95
- INDENT_1[:case_when_outdented_whens_level] =
95
+ INDENT_1['case_when_outdented_whens_level'] =
96
96
  %Q{def my_method
97
97
  case true
98
98
  when true
@@ -102,7 +102,7 @@ INDENT_1[:case_when_outdented_whens_level] =
102
102
  end
103
103
  end}
104
104
 
105
- INDENT_1[:case_indented_whens_in] =
105
+ INDENT_1['case_indented_whens_in'] =
106
106
  %Q{def my_method
107
107
  case true
108
108
  when true
@@ -112,33 +112,33 @@ INDENT_1[:case_indented_whens_in] =
112
112
  end
113
113
  end}
114
114
 
115
- INDENT_1[:while_do_indented] =
115
+ INDENT_1['while_do_indented'] =
116
116
  %Q{ while true do
117
117
  puts "something"
118
118
  end}
119
119
 
120
- INDENT_1[:while_do_outdented] =
120
+ INDENT_1['while_do_outdented'] =
121
121
  %Q{def my_method
122
122
  while true do
123
123
  puts "something"
124
124
  end
125
125
  end}
126
126
 
127
- INDENT_1[:while_do_content_outdented] =
127
+ INDENT_1['while_do_content_outdented'] =
128
128
  %Q{def my_method
129
129
  while true do
130
130
  puts "something"
131
131
  end
132
132
  end}
133
133
 
134
- INDENT_1[:while_do_content_indented] =
134
+ INDENT_1['while_do_content_indented'] =
135
135
  %Q{def my_method
136
136
  while true do
137
137
  puts "something"
138
138
  end
139
139
  end}
140
140
 
141
- INDENT_1[:while_do_indented2] =
141
+ INDENT_1['while_do_indented2'] =
142
142
  %Q{i = 0;
143
143
  num = 5;
144
144
 
@@ -147,7 +147,7 @@ num = 5;
147
147
  i +=1;
148
148
  end}
149
149
 
150
- INDENT_1[:while_do_indented2_trailing_comment] =
150
+ INDENT_1['while_do_indented2_trailing_comment'] =
151
151
  %Q{i = 0;
152
152
  num = 5;
153
153
 
@@ -156,7 +156,7 @@ num = 5;
156
156
  i +=1;
157
157
  end}
158
158
 
159
- INDENT_1[:until_do_indented] =
159
+ INDENT_1['until_do_indented'] =
160
160
  %Q{i = 0;
161
161
  num = 5;
162
162
 
@@ -165,17 +165,17 @@ num = 5;
165
165
  i +=1;
166
166
  end}
167
167
 
168
- INDENT_1[:for_do_indented] =
168
+ INDENT_1['for_do_indented'] =
169
169
  %Q{ for i in 1..100 do
170
170
  puts i
171
171
  end}
172
172
 
173
- INDENT_1[:loop_do_indented] =
173
+ INDENT_1['loop_do_indented'] =
174
174
  %Q{ loop do
175
175
  puts 'looping'
176
176
  end}
177
177
 
178
- INDENT_1[:if_line_indented] =
178
+ INDENT_1['if_line_indented'] =
179
179
  %Q{def a_method
180
180
  if defined? Term::ANSIColor
181
181
  message << %Q{# \#{(i + 1).to_s.bold}.
@@ -192,7 +192,7 @@ INDENT_1[:if_line_indented] =
192
192
  end
193
193
  end}
194
194
 
195
- INDENT_1[:if_line_indented_trailing_comment] =
195
+ INDENT_1['if_line_indented_trailing_comment'] =
196
196
  %Q{def a_method
197
197
  if defined? Term::ANSIColor # comment
198
198
  message << %Q{# \#{(i + 1).to_s.bold}.
@@ -209,7 +209,7 @@ INDENT_1[:if_line_indented_trailing_comment] =
209
209
  end
210
210
  end}
211
211
 
212
- INDENT_1[:multi_line_tstring] =
212
+ INDENT_1['multi_line_tstring'] =
213
213
  %Q{INDENT_OK[:class] =
214
214
  %Q{class MyClass
215
215
  end}}
@@ -217,29 +217,29 @@ end}}
217
217
  #-------------------------------------------------------------------------------
218
218
  # Operators
219
219
  #-------------------------------------------------------------------------------
220
- INDENT_1[:multi_line_andop_first_line_indented] =
220
+ INDENT_1['multi_line_andop_first_line_indented'] =
221
221
  %Q{def end_of_multiline_string?(lexed_line_output)
222
222
  lexed_line_output.any? { |e| e[1] == :on_tstring_end } &&
223
223
  lexed_line_output.none? { |e| e[1] == :on_tstring_beg }
224
224
  end}
225
225
 
226
- INDENT_1[:multi_line_andop_first_line_indented_trailing_comment] =
226
+ INDENT_1['multi_line_andop_first_line_indented_trailing_comment'] =
227
227
  %Q{def end_of_multiline_string?(lexed_line_output)
228
228
  lexed_line_output.any? { |e| e[1] == :on_tstring_end } && # comment
229
229
  lexed_line_output.none? { |e| e[1] == :on_tstring_beg }
230
230
  end}
231
231
 
232
- INDENT_1[:multi_line_andop_second_line_indented] =
232
+ INDENT_1['multi_line_andop_second_line_indented'] =
233
233
  %Q{def end_of_multiline_string?(lexed_line_output)
234
234
  lexed_line_output.any? { |e| e[1] == :on_tstring_end } &&
235
235
  lexed_line_output.none? { |e| e[1] == :on_tstring_beg }
236
236
  end}
237
237
 
238
- INDENT_1[:multi_line_string_concat_with_plus_out] =
238
+ INDENT_1['multi_line_string_concat_with_plus_out'] =
239
239
  %Q{DVR_SSDP_NOTIFICATION_TEMPLATE = File.dirname(__FILE__) +
240
240
  '/profiles/DVR5000/ssdp_notification.erb'}
241
241
 
242
- INDENT_1[:multi_line_method_call_end_in] =
242
+ INDENT_1['multi_line_method_call_end_in'] =
243
243
  %Q{def initialize(raw_response)
244
244
  if raw_response.nil? || raw_response.empty?
245
245
  raise RTSP::Error,
@@ -247,19 +247,19 @@ INDENT_1[:multi_line_method_call_end_in] =
247
247
  end
248
248
  end}
249
249
 
250
- INDENT_1[:multi_line_method_call_ends_with_period_2nd_line_in] =
250
+ INDENT_1['multi_line_method_call_ends_with_period_2nd_line_in'] =
251
251
  %Q{unless streamer == MulticastStreamer.instance
252
252
  streamer.state = :DISCONNECTED
253
253
  UnicastStreamer.pool << streamer unless UnicastStreamer.pool.
254
254
  member? streamer
255
255
  end}
256
256
 
257
- INDENT_1[:multi_line_method_call_ends_with_many_periods_last_in] =
257
+ INDENT_1['multi_line_method_call_ends_with_many_periods_last_in'] =
258
258
  %Q{my_hashie.first_level.
259
259
  second_level.
260
260
  third_level}
261
261
 
262
- INDENT_1[:multi_line_method_call_ends_with_many_periods_last_in_trailing_comment] =
262
+ INDENT_1['multi_line_method_call_ends_with_many_periods_last_in_trailing_comment'] =
263
263
  %Q{my_hashie.first_level.
264
264
  second_level.
265
265
  third_level # comment}
@@ -1,83 +1,83 @@
1
1
  INDENT_OK = {}
2
2
 
3
- INDENT_OK[:class] =
3
+ INDENT_OK['class'] =
4
4
  %Q{class MyClass
5
5
  end}
6
6
 
7
- INDENT_OK[:one_line_class] =
7
+ INDENT_OK['one_line_class'] =
8
8
  %Q{class MyClass; end}
9
9
 
10
- INDENT_OK[:one_line_subclass] =
10
+ INDENT_OK['one_line_subclass'] =
11
11
  %Q{class MyClass < RuntimeError; end}
12
12
 
13
- INDENT_OK[:one_line_subclass_with_inheritance] =
13
+ INDENT_OK['one_line_subclass_with_inheritance'] =
14
14
  %Q{class MyClass < Array
15
15
  class MyError < RuntimeError; end
16
16
  include AnotherThing
17
17
  end}
18
18
 
19
- INDENT_OK[:class_empty] =
19
+ INDENT_OK['class_empty'] =
20
20
  %Q{class MyClass
21
21
 
22
22
  end}
23
23
 
24
- INDENT_OK[:class_empty_trailing_comment] =
24
+ INDENT_OK['class_empty_trailing_comment'] =
25
25
  %Q{class MyClass # Comment!
26
26
 
27
27
  end}
28
28
 
29
- INDENT_OK[:class_singlestatement] =
29
+ INDENT_OK['class_singlestatement'] =
30
30
  %Q{class MyClass
31
31
  include Stuff
32
32
  end}
33
33
 
34
- INDENT_OK[:assignment_addition_multistatement] =
34
+ INDENT_OK['assignment_addition_multistatement'] =
35
35
  %Q{thing = 1 +
36
36
  2 + 3 + 4 +
37
37
  5}
38
38
 
39
- INDENT_OK[:assignment_addition_multistatement_trailing_comment] =
39
+ INDENT_OK['assignment_addition_multistatement_trailing_comment'] =
40
40
  %Q{thing = 1 + # Comment!
41
41
  2 + 3 + 4 +
42
42
  5}
43
43
 
44
- INDENT_OK[:assignment_hash_multistatement] =
44
+ INDENT_OK['assignment_hash_multistatement'] =
45
45
  %Q{thing = {
46
46
  :one => 'one',
47
47
  two: 'two'
48
48
  }}
49
49
 
50
- INDENT_OK[:assignment_hash_multistatement_trailing_comment] =
50
+ INDENT_OK['assignment_hash_multistatement_trailing_comment'] =
51
51
  %Q{thing = {
52
52
  :one => 'one', # Comment
53
53
  two: 'two'
54
54
  }}
55
55
 
56
- INDENT_OK[:assignment_array_multistatement] =
56
+ INDENT_OK['assignment_array_multistatement'] =
57
57
  %Q{thing = [
58
58
  :one,
59
59
  :two
60
60
  ]}
61
61
 
62
- INDENT_OK[:assignment_array_multistatement_trailing_comment] =
62
+ INDENT_OK['assignment_array_multistatement_trailing_comment'] =
63
63
  %Q{thing = [
64
64
  :one, # comment
65
65
  :two
66
66
  ]}
67
67
 
68
- INDENT_OK[:assignment_paren_multistatement] =
68
+ INDENT_OK['assignment_paren_multistatement'] =
69
69
  %Q{eval('puts',
70
70
  binding,
71
71
  'my_file.rb',
72
72
  5)}
73
73
 
74
- INDENT_OK[:assignment_paren_multistatement_trailing_comment] =
74
+ INDENT_OK['assignment_paren_multistatement_trailing_comment'] =
75
75
  %Q{eval('puts',
76
76
  binding,
77
77
  'my_file.rb', # comment
78
78
  5)}
79
79
 
80
- INDENT_OK[:assignment_twolevel_hash_multistatement] =
80
+ INDENT_OK['assignment_twolevel_hash_multistatement'] =
81
81
  %Q{thing = {
82
82
  :one => {
83
83
  :a => 'a',
@@ -89,7 +89,7 @@ INDENT_OK[:assignment_twolevel_hash_multistatement] =
89
89
  }
90
90
  }}
91
91
 
92
- INDENT_OK[:assignment_twolevel_array_multistatement] =
92
+ INDENT_OK['assignment_twolevel_array_multistatement'] =
93
93
  %Q{thing = [
94
94
  [:one],
95
95
  [
@@ -98,7 +98,7 @@ INDENT_OK[:assignment_twolevel_array_multistatement] =
98
98
  ]
99
99
  ]}
100
100
 
101
- INDENT_OK[:assignment_twolevel_paren_multistatement] =
101
+ INDENT_OK['assignment_twolevel_paren_multistatement'] =
102
102
  %Q{result = Integer(
103
103
  String.new(
104
104
  "1"
@@ -106,26 +106,26 @@ INDENT_OK[:assignment_twolevel_paren_multistatement] =
106
106
  16
107
107
  )}
108
108
 
109
- INDENT_OK[:method_call_multistatement] =
109
+ INDENT_OK['method_call_multistatement'] =
110
110
  %Q{my_method_with_many_params(one, two,
111
111
  three,
112
112
  four,
113
113
  five)}
114
114
 
115
- INDENT_OK[:method_call_multistatement_trailing_comment] =
115
+ INDENT_OK['method_call_multistatement_trailing_comment'] =
116
116
  %Q{my_method_with_many_params(one, two,
117
117
  three, # comment
118
118
  four,
119
119
  five)}
120
120
 
121
- INDENT_OK[:method_call_multistatement_lonely_paren] =
121
+ INDENT_OK['method_call_multistatement_lonely_paren'] =
122
122
  %Q{my_method_with_many_params(one, two,
123
123
  three,
124
124
  four,
125
125
  five
126
126
  )}
127
127
 
128
- INDENT_OK[:method_call_multistatement_lonely_paren_trailing_comment] =
128
+ INDENT_OK['method_call_multistatement_lonely_paren_trailing_comment'] =
129
129
  %Q{my_method_with_many_params(one, two, # comment
130
130
  three,
131
131
  four,
@@ -135,7 +135,7 @@ INDENT_OK[:method_call_multistatement_lonely_paren_trailing_comment] =
135
135
  #-------------------------------------------------------------------------------
136
136
  # Continuation keywords
137
137
  #-------------------------------------------------------------------------------
138
- INDENT_OK[:rescue_ending_with_comma] =
138
+ INDENT_OK['rescue_ending_with_comma'] =
139
139
  %Q{begin
140
140
  ssh.upload source, dest
141
141
  @logger.info "Successfully copied the file \#{source} to " +
@@ -146,7 +146,7 @@ rescue SocketError, ArgumentError, SystemCallError,
146
146
  "\#{ex.message}"
147
147
  end}
148
148
 
149
- INDENT_OK[:rescue_ending_with_comma_trailing_comment] =
149
+ INDENT_OK['rescue_ending_with_comma_trailing_comment'] =
150
150
  %Q{begin
151
151
  ssh.upload source, dest
152
152
  @logger.info "Successfully copied the file \#{source} to " +
@@ -157,7 +157,7 @@ rescue SocketError, ArgumentError, SystemCallError, # comment
157
157
  "\#{ex.message}"
158
158
  end}
159
159
 
160
- INDENT_OK[:def_rescue] =
160
+ INDENT_OK['def_rescue'] =
161
161
  %Q{def some_method
162
162
  do_something(one, two)
163
163
  rescue => e
@@ -165,48 +165,48 @@ rescue => e
165
165
  raise e
166
166
  end}
167
167
 
168
- INDENT_OK[:keyword_ending_with_period] =
168
+ INDENT_OK['keyword_ending_with_period'] =
169
169
  %Q{if [].
170
170
  empty?
171
171
  puts 'hi'
172
172
  end}
173
173
 
174
- INDENT_OK[:keyword_ending_with_period_trailing_comment] =
174
+ INDENT_OK['keyword_ending_with_period_trailing_comment'] =
175
175
  %Q{if []. # comment
176
176
  empty?
177
177
  puts 'hi'
178
178
  end}
179
179
 
180
- INDENT_OK[:def] =
180
+ INDENT_OK['def'] =
181
181
  %Q{def a_method
182
182
  end}
183
183
 
184
- INDENT_OK[:def_empty] =
184
+ INDENT_OK['def_empty'] =
185
185
  %Q{def a_method
186
186
 
187
187
  end}
188
188
 
189
- INDENT_OK[:nested_def] =
189
+ INDENT_OK['nested_def'] =
190
190
  %Q{def first_method
191
191
  def second_method
192
192
  puts "hi"
193
193
  end
194
194
  end}
195
195
 
196
- INDENT_OK[:nested_class] =
196
+ INDENT_OK['nested_class'] =
197
197
  %Q{class MyClass
198
198
  class AnotherClass
199
199
  end
200
200
  end}
201
201
 
202
- INDENT_OK[:require_class_singlestatement] =
202
+ INDENT_OK['require_class_singlestatement'] =
203
203
  %Q{require 'time'
204
204
 
205
205
  class MyClass
206
206
  include Stuff
207
207
  end}
208
208
 
209
- INDENT_OK[:class_as_symbol] =
209
+ INDENT_OK['class_as_symbol'] =
210
210
  %Q{INDENT_OK = {}
211
211
 
212
212
  INDENT_OK[:class] =
@@ -216,7 +216,7 @@ end}
216
216
  INDENT_OK[:one_line_class] =
217
217
  %Q{class MyClass; end}}
218
218
 
219
- INDENT_OK[:require_class_singlestatement_def] =
219
+ INDENT_OK['require_class_singlestatement_def'] =
220
220
  %Q{require 'time'
221
221
 
222
222
  class MyClass
@@ -226,7 +226,7 @@ class MyClass
226
226
  end
227
227
  end}
228
228
 
229
- INDENT_OK[:require_class_singlestatement_def_content] =
229
+ INDENT_OK['require_class_singlestatement_def_content'] =
230
230
  %Q{require 'time'
231
231
 
232
232
  class MyClass
@@ -237,35 +237,35 @@ class MyClass
237
237
  end
238
238
  end}
239
239
 
240
- INDENT_OK[:if_modifier] =
240
+ INDENT_OK['if_modifier'] =
241
241
  %Q{puts "hi" if nil.nil?}
242
242
 
243
- INDENT_OK[:if_modifier2] =
243
+ INDENT_OK['if_modifier2'] =
244
244
  %Q{start_key_registration_server if @profiles.values.include? :SM5000}
245
245
 
246
- INDENT_OK[:def_return_if_modifier] =
246
+ INDENT_OK['def_return_if_modifier'] =
247
247
  %Q{def a_method
248
248
  return @something if @something
249
249
  end}
250
250
 
251
- INDENT_OK[:unless_modifier] =
251
+ INDENT_OK['unless_modifier'] =
252
252
  %Q{puts "hi" unless nil.nil?}
253
253
 
254
- INDENT_OK[:def_return_unless_modifier] =
254
+ INDENT_OK['def_return_unless_modifier'] =
255
255
  %Q{def a_method
256
256
  return @something unless @something
257
257
  end}
258
258
 
259
- INDENT_OK[:multi_line_if_with_trailing_andop] =
259
+ INDENT_OK['multi_line_if_with_trailing_andop'] =
260
260
  %Q{unless Tim::Runner.configuration[:scp_hostname].nil?
261
261
  @reporter.secure_copy if Tim::Runner.configuration[:scp_username] &&
262
262
  Tim::Runner.configuration[:scp_password]
263
263
  end}
264
264
 
265
- INDENT_OK[:while_within_single_line_block] =
265
+ INDENT_OK['while_within_single_line_block'] =
266
266
  %Q{Timeout::timeout(DEVICE_TIMEOUT) { sleep(0.5) while @device_server.urls.nil? }}
267
267
 
268
- INDENT_OK[:case_whens_level] =
268
+ INDENT_OK['case_whens_level'] =
269
269
  %Q{def my_method
270
270
  case true
271
271
  when true
@@ -275,7 +275,7 @@ INDENT_OK[:case_whens_level] =
275
275
  end
276
276
  end}
277
277
 
278
- INDENT_OK[:case_strings_in_strings] =
278
+ INDENT_OK['case_strings_in_strings'] =
279
279
  %Q{case type
280
280
  when :output
281
281
  "I like to \#{eval('puts')}, but should be \#{eval('print')}"
@@ -284,7 +284,7 @@ when :input
284
284
  end}
285
285
 
286
286
  =begin
287
- INDENT_OK[:case_whens_in] =
287
+ INDENT_OK['case_whens_in'] =
288
288
  %Q{def my_method
289
289
  case true
290
290
  when true
@@ -295,12 +295,12 @@ INDENT_OK[:case_whens_in] =
295
295
  end}
296
296
  =end
297
297
 
298
- INDENT_OK[:while_do_loop] =
298
+ INDENT_OK['while_do_loop'] =
299
299
  %Q{while true do
300
300
  puts "something"
301
301
  end}
302
302
 
303
- INDENT_OK[:while_do_loop2] =
303
+ INDENT_OK['while_do_loop2'] =
304
304
  %Q{i = 0;
305
305
  num = 5;
306
306
 
@@ -309,12 +309,12 @@ while i < num do
309
309
  i +=1;
310
310
  end}
311
311
 
312
- INDENT_OK[:until_do_loop] =
312
+ INDENT_OK['until_do_loop'] =
313
313
  %Q{until true do
314
314
  puts "something"
315
315
  end}
316
316
 
317
- INDENT_OK[:until_do_loop2] =
317
+ INDENT_OK['until_do_loop2'] =
318
318
  %Q{i = 0;
319
319
  num = 5;
320
320
 
@@ -323,17 +323,17 @@ until i > num do
323
323
  i +=1;
324
324
  end}
325
325
 
326
- INDENT_OK[:for_do_loop] =
326
+ INDENT_OK['for_do_loop'] =
327
327
  %Q{for i in 1..100 do
328
328
  puts i
329
329
  end}
330
330
 
331
- INDENT_OK[:loop_do_loop] =
331
+ INDENT_OK['loop_do_loop'] =
332
332
  %Q{loop do
333
333
  puts 'looping'
334
334
  end}
335
335
 
336
- INDENT_OK[:while_as_modifier_loop] =
336
+ INDENT_OK['while_as_modifier_loop'] =
337
337
  %Q{i = 0;
338
338
  num = 5;
339
339
  begin
@@ -341,7 +341,7 @@ begin
341
341
  i +=1;
342
342
  end while i < num}
343
343
 
344
- INDENT_OK[:until_as_modifier_loop] =
344
+ INDENT_OK['until_as_modifier_loop'] =
345
345
  %Q{i = 0;
346
346
  num = 5;
347
347
  begin
@@ -349,7 +349,7 @@ begin
349
349
  i +=1;
350
350
  end until i > num}
351
351
 
352
- INDENT_OK[:for_with_break_loop] =
352
+ INDENT_OK['for_with_break_loop'] =
353
353
  %Q{for i in 0..5
354
354
  if i > 2 then
355
355
  break
@@ -357,7 +357,7 @@ INDENT_OK[:for_with_break_loop] =
357
357
  puts "Value of local variable is \#{i}"
358
358
  end}
359
359
 
360
- INDENT_OK[:for_with_next_loop] =
360
+ INDENT_OK['for_with_next_loop'] =
361
361
  %Q{for i in 0..5
362
362
  if i < 2 then
363
363
  next
@@ -365,7 +365,7 @@ INDENT_OK[:for_with_next_loop] =
365
365
  puts "Value of local variable is \#{i}"
366
366
  end}
367
367
 
368
- INDENT_OK[:for_with_redo_loop] =
368
+ INDENT_OK['for_with_redo_loop'] =
369
369
  %Q{for i in 0..5
370
370
  if i < 2 then
371
371
  puts "Value of local variable is \#{i}"
@@ -373,52 +373,52 @@ INDENT_OK[:for_with_redo_loop] =
373
373
  end
374
374
  end}
375
375
 
376
- INDENT_OK[:for_with_retry_loop] =
376
+ INDENT_OK['for_with_retry_loop'] =
377
377
  %Q{for i in 1..5
378
378
  retry if i > 2
379
379
  puts "Value of local variable is \#{i}"
380
380
  end}
381
381
 
382
- INDENT_OK[:loop_with_braces] =
382
+ INDENT_OK['loop_with_braces'] =
383
383
  %Q<loop {
384
384
  puts 'stuff'
385
385
  }>
386
386
 
387
387
  #----------- Braces ----------#
388
- INDENT_OK[:single_line_braces] =
388
+ INDENT_OK['single_line_braces'] =
389
389
  %Q<{ one: 1, two: 2 }>
390
390
 
391
- INDENT_OK[:single_line_braces_as_t_string] =
391
+ INDENT_OK['single_line_braces_as_t_string'] =
392
392
  %Q<%Q{this is a t string!}>
393
393
 
394
- INDENT_OK[:multi_line_braces] =
394
+ INDENT_OK['multi_line_braces'] =
395
395
  %Q<{ one: 1,
396
396
  two: 2 }>
397
397
 
398
- INDENT_OK[:multi_line_braces_as_t_string] =
398
+ INDENT_OK['multi_line_braces_as_t_string'] =
399
399
  %Q<%Q{this is a t string!
400
400
  suckaaaaaa!}>
401
401
 
402
402
  # For some reason, Ruby doesn't like '%Q<> here. Using [] instead.
403
- INDENT_OK[:multi_line_lonely_braces] =
403
+ INDENT_OK['multi_line_lonely_braces'] =
404
404
  %Q[{
405
405
  :one => 'one', :two => 'two',
406
406
  :three => 'three'
407
407
  }]
408
408
 
409
- INDENT_OK[:multi_line_lonely_braces_as_t_string] =
409
+ INDENT_OK['multi_line_lonely_braces_as_t_string'] =
410
410
  %Q<%Q{
411
411
  this is a t string!
412
412
  suckaaaaaa!
413
413
  }>
414
414
 
415
- INDENT_OK[:multi_line_braces_embedded_arrays] =
415
+ INDENT_OK['multi_line_braces_embedded_arrays'] =
416
416
  %Q[{
417
417
  :one => ['one', 17, {}], :two => ['two'],
418
418
  :three => 'three'
419
419
  }]
420
420
 
421
- INDENT_OK[:braces_combo] =
421
+ INDENT_OK['braces_combo'] =
422
422
  %Q<{ three: 3 }
423
423
  {
424
424
  three: 3 }
@@ -428,7 +428,7 @@ INDENT_OK[:braces_combo] =
428
428
  three: 3
429
429
  }>
430
430
 
431
- INDENT_OK[:deep_hash_with_rockets] =
431
+ INDENT_OK['deep_hash_with_rockets'] =
432
432
  %Q[im_deep =
433
433
  { "one" =>
434
434
  { "1" =>
@@ -440,7 +440,7 @@ INDENT_OK[:deep_hash_with_rockets] =
440
440
  "e" => "E",
441
441
  "f" => "F" } } }]
442
442
 
443
- INDENT_OK[:embedded_strings_in_embedded_strings] =
443
+ INDENT_OK['embedded_strings_in_embedded_strings'] =
444
444
  %q[def friendly_time(time)
445
445
  if hours < 24
446
446
  "#{(hours > 0) ? "#{hours} hour" : '' }#{(hours > 1) ? 's' : ''}" +
@@ -452,41 +452,41 @@ INDENT_OK[:embedded_strings_in_embedded_strings] =
452
452
  end]
453
453
 
454
454
  #----------- Brackets ----------#
455
- INDENT_OK[:single_line_brackets] =
455
+ INDENT_OK['single_line_brackets'] =
456
456
  %Q{['one', 'two', 'three']}
457
457
 
458
- INDENT_OK[:single_line_brackets_as_t_string] =
458
+ INDENT_OK['single_line_brackets_as_t_string'] =
459
459
  %Q{%Q[this is a t string!]}
460
460
 
461
- INDENT_OK[:multi_line_brackets] =
461
+ INDENT_OK['multi_line_brackets'] =
462
462
  %Q{['one',
463
463
  'two',
464
464
  'three']}
465
465
 
466
- INDENT_OK[:multi_line_brackets_as_t_string] =
466
+ INDENT_OK['multi_line_brackets_as_t_string'] =
467
467
  %Q{%Q[this is a t string!
468
468
  it doesn't matter that this is way over here.
469
469
  suckaaaaaa!]}
470
470
 
471
- INDENT_OK[:multi_line_lonely_brackets] =
471
+ INDENT_OK['multi_line_lonely_brackets'] =
472
472
  %Q{[
473
473
  'one',
474
474
  'two',
475
475
  'three'
476
476
  ]}
477
477
 
478
- INDENT_OK[:multi_line_lonely_brackets_as_t_string] =
478
+ INDENT_OK['multi_line_lonely_brackets_as_t_string'] =
479
479
  %Q{%Q[
480
480
  this is a t string!
481
481
  it doesn't matter that this is way over here.
482
482
  suckaaaaaa!
483
483
  ]}
484
484
 
485
- INDENT_OK[:multi_line_brackets_embedded_hashes] =
485
+ INDENT_OK['multi_line_brackets_embedded_hashes'] =
486
486
  %Q{summary_table.rows << [{ value: "File", align: :center },
487
487
  { value: "Total Problems", align: :center }]}
488
488
 
489
- INDENT_OK[:brackets_combo] =
489
+ INDENT_OK['brackets_combo'] =
490
490
  %Q{[2]
491
491
  [
492
492
  2]
@@ -498,40 +498,40 @@ INDENT_OK[:brackets_combo] =
498
498
 
499
499
  #----------- Parens ----------#
500
500
 
501
- INDENT_OK[:single_line_parens] =
501
+ INDENT_OK['single_line_parens'] =
502
502
  %Q{(true || false)}
503
503
 
504
- INDENT_OK[:single_line_parens_as_t_string] =
504
+ INDENT_OK['single_line_parens_as_t_string'] =
505
505
  %Q{%Q(this is a t string!)}
506
506
 
507
- INDENT_OK[:multi_line_parens] =
507
+ INDENT_OK['multi_line_parens'] =
508
508
  %Q{my_method(first_argument, second_arg,
509
509
  third_arg)}
510
510
 
511
- INDENT_OK[:multi_line_parens_as_t_string] =
511
+ INDENT_OK['multi_line_parens_as_t_string'] =
512
512
  %Q{%Q(this is a t string!
513
513
  and i'm not going
514
514
  anywhere!')}
515
515
 
516
- INDENT_OK[:multi_line_lonely_parens] =
516
+ INDENT_OK['multi_line_lonely_parens'] =
517
517
  %Q{my_method(
518
518
  first_argument
519
519
  )}
520
520
 
521
- INDENT_OK[:multi_line_lonely_parens_with_commas] =
521
+ INDENT_OK['multi_line_lonely_parens_with_commas'] =
522
522
  %Q{my_method(
523
523
  first_argument, second_arg,
524
524
  third_arg
525
525
  )}
526
526
 
527
- INDENT_OK[:multi_line_lonely_parens_as_t_string] =
527
+ INDENT_OK['multi_line_lonely_parens_as_t_string'] =
528
528
  %Q{%Q(
529
529
  this is a t string!
530
530
  and i'm not going
531
531
  anywhere!'
532
532
  )}
533
533
 
534
- INDENT_OK[:parens_combo] =
534
+ INDENT_OK['parens_combo'] =
535
535
  %Q{(1)
536
536
  (
537
537
  1)
@@ -545,19 +545,19 @@ INDENT_OK[:parens_combo] =
545
545
  #-------------------------------------------------------------------------------
546
546
  # Operators
547
547
  #-------------------------------------------------------------------------------
548
- INDENT_OK[:multi_line_ops] =
548
+ INDENT_OK['multi_line_ops'] =
549
549
  %Q{2 -
550
550
  1 -
551
551
  0 +
552
552
  12}
553
553
 
554
- INDENT_OK[:multi_line_andop_in_method] =
554
+ INDENT_OK['multi_line_andop_in_method'] =
555
555
  %Q{def end_of_multiline_string?(lexed_line_output)
556
556
  lexed_line_output.any? { |e| e[1] == :on_tstring_end } &&
557
557
  lexed_line_output.none? { |e| e[1] == :on_tstring_beg }
558
558
  end}
559
559
 
560
- INDENT_OK[:multi_line_rshift_in_method] =
560
+ INDENT_OK['multi_line_rshift_in_method'] =
561
561
  %Q{rule(:transport_specifier) do
562
562
  match('[A-Za-z]').repeat(3).as(:streaming_protocol) >> forward_slash >>
563
563
  match('[A-Za-z]').repeat(3).as(:profile) >>
@@ -573,15 +573,15 @@ rule(:ttl) do
573
573
  str('ttl=') >> match('[\d]').repeat(1, 3).as(:ttl)
574
574
  end}
575
575
 
576
- INDENT_OK[:multi_line_string_concat_with_plus] =
576
+ INDENT_OK['multi_line_string_concat_with_plus'] =
577
577
  %Q{DVR_SSDP_NOTIFICATION_TEMPLATE = File.dirname(__FILE__) +
578
578
  '/profiles/DVR5000/ssdp_notification.erb'}
579
579
 
580
- INDENT_OK[:multi_line_string_concat_with_plus_in_parens] =
580
+ INDENT_OK['multi_line_string_concat_with_plus_in_parens'] =
581
581
  %Q{DVR_CONFIG_RENDERER = Erubis::Eruby.new(File.read File.dirname(__FILE__) +
582
582
  '/profiles/DVR5000/device_config.xml.erb')}
583
583
 
584
- INDENT_OK[:multi_line_string_concat_twice] =
584
+ INDENT_OK['multi_line_string_concat_twice'] =
585
585
  %Q{unless Tim::Runner.configuration[:email].nil? ||
586
586
  Tim::Runner.configuration[:email].empty?
587
587
  Tim::EmailReporter.subject_status ||= subject_status
@@ -597,7 +597,7 @@ end}
597
597
  #-------------------------------------------------------------------------------
598
598
  # Method calls
599
599
  #-------------------------------------------------------------------------------
600
- INDENT_OK[:multi_line_method_call] =
600
+ INDENT_OK['multi_line_method_call'] =
601
601
  %Q{def initialize(raw_response)
602
602
  if raw_response.nil? || raw_response.empty?
603
603
  raise RTSP::Error,
@@ -611,26 +611,26 @@ INDENT_OK[:multi_line_method_call] =
611
611
  @body = parse_body(body)
612
612
  end}
613
613
 
614
- INDENT_OK[:multi_line_method_call_ends_with_period] =
614
+ INDENT_OK['multi_line_method_call_ends_with_period'] =
615
615
  %Q{unless streamer == MulticastStreamer.instance
616
616
  streamer.state = :DISCONNECTED
617
617
  UnicastStreamer.pool << streamer unless UnicastStreamer.pool.
618
618
  member? streamer
619
619
  end}
620
620
 
621
- INDENT_OK[:multi_line_method_call_ends_with_many_periods] =
621
+ INDENT_OK['multi_line_method_call_ends_with_many_periods'] =
622
622
  %Q{my_hashie.first_level.
623
623
  second_level.
624
624
  third_level}
625
625
 
626
626
  =begin
627
- INDENT_OK[:method_closing_lonely_paren] =
627
+ INDENT_OK['method_closing_lonely_paren'] =
628
628
  %Q{def your_thing(one
629
629
  )
630
630
  end}
631
631
  =end
632
632
 
633
- INDENT_OK[:method_lonely_args] =
633
+ INDENT_OK['method_lonely_args'] =
634
634
  %Q{def your_thing(
635
635
  one
636
636
  )
@@ -640,7 +640,7 @@ end}
640
640
  #------------------------------------------------------------------------------
641
641
  # If + logical operators
642
642
  #------------------------------------------------------------------------------
643
- INDENT_OK[:multi_line_if_logical_and] =
643
+ INDENT_OK['multi_line_if_logical_and'] =
644
644
  %Q{if @indentation_ruler.op_statement_nesting.empty? &&
645
645
  @indentation_ruler.tstring_nesting.empty? &&
646
646
  @indentation_ruler.paren_nesting.empty? &&
@@ -656,7 +656,7 @@ INDENT_OK[:multi_line_if_logical_and] =
656
656
  end
657
657
  end}
658
658
 
659
- INDENT_OK[:multi_line_each_block] =
659
+ INDENT_OK['multi_line_each_block'] =
660
660
  %Q{style.each do |ruler_name, value|
661
661
  instance_eval(
662
662
  "Tailor::Rulers::\#{camelize(ruler_name.to_s)}Ruler.new(\#{value})"
@@ -664,7 +664,7 @@ INDENT_OK[:multi_line_each_block] =
664
664
  parent_ruler.add_child_ruler(ruler)
665
665
  end}
666
666
 
667
- INDENT_OK[:multi_line_each_block_with_op_and_parens] =
667
+ INDENT_OK['multi_line_each_block_with_op_and_parens'] =
668
668
  %Q{style.each do |ruler_name, value|
669
669
  ruler =
670
670
  instance_eval(
@@ -673,7 +673,7 @@ INDENT_OK[:multi_line_each_block_with_op_and_parens] =
673
673
  parent_ruler.add_child_ruler(ruler)
674
674
  end}
675
675
 
676
- INDENT_OK[:do_end_block_in_parens] =
676
+ INDENT_OK['do_end_block_in_parens'] =
677
677
  %Q{begin
678
678
  throw(:result, sexp_line.flatten.compact.any? do |s|
679
679
  s == MODIFIERS[self]
@@ -681,7 +681,7 @@ INDENT_OK[:do_end_block_in_parens] =
681
681
  rescue NoMethodError
682
682
  end}
683
683
 
684
- INDENT_OK[:block_in_block_ends_on_same_line] =
684
+ INDENT_OK['block_in_block_ends_on_same_line'] =
685
685
  %Q{%w{
686
686
  foo
687
687
  bar
@@ -694,7 +694,7 @@ INDENT_OK[:block_in_block_ends_on_same_line] =
694
694
  puts "post ends"}
695
695
 
696
696
  =begin
697
- INDENT_OK[:rparen_and_do_same_line] =
697
+ INDENT_OK['rparen_and_do_same_line'] =
698
698
  %Q{opt.on('-c', '--config-file FILE',
699
699
  "Use a specific config file.") do |config|
700
700
  options.config_file = config
@@ -704,7 +704,7 @@ end}
704
704
  #-------------------------------------------------------------------------------
705
705
  # Single-line keywords
706
706
  #-------------------------------------------------------------------------------
707
- INDENT_OK[:single_line_begin_rescue_end] =
707
+ INDENT_OK['single_line_begin_rescue_end'] =
708
708
  %Q{def log
709
709
  l = begin; lineno; rescue; "<EOF>"; end
710
710
  c = begin; column; rescue; "<EOF>"; end
@@ -716,7 +716,7 @@ end}
716
716
  #-------------------------------------------------------------------------------
717
717
  # Combos
718
718
  #-------------------------------------------------------------------------------
719
- INDENT_OK[:combo1] =
719
+ INDENT_OK['combo1'] =
720
720
  %Q{def set_default_smtp
721
721
  Mail.defaults do
722
722
  @config = Tim::Runner.configuration
@@ -726,7 +726,7 @@ INDENT_OK[:combo1] =
726
726
  end
727
727
  end}
728
728
 
729
- INDENT_OK[:combo2] =
729
+ INDENT_OK['combo2'] =
730
730
  %Q{class C
731
731
 
732
732
  send :each do
@@ -736,7 +736,7 @@ INDENT_OK[:combo2] =
736
736
 
737
737
  end}
738
738
 
739
- INDENT_OK[:combo3] =
739
+ INDENT_OK['combo3'] =
740
740
  %Q{def report_turducken(results, performance_results)
741
741
  stuffing[:log_files] = { "\#{File.basename @logger.log_file_location}" =>
742
742
  File.read(@logger.log_file_location).gsub(/(?<f><)(?<q>\\/)?(?<w>\\w)/,
@@ -753,13 +753,13 @@ INDENT_OK[:combo3] =
753
753
  suite_result_url
754
754
  end}
755
755
 
756
- INDENT_OK[:brace_bracket_paren_combo1] =
756
+ INDENT_OK['brace_bracket_paren_combo1'] =
757
757
  %Q{[{ :one => your_thing(
758
758
  1)
759
759
  }
760
760
  ]}
761
761
 
762
- INDENT_OK[:paren_comma_combo1] =
762
+ INDENT_OK['paren_comma_combo1'] =
763
763
  %Q{def do_something
764
764
  self[:log_file_location] = Time.now.strftime(File.join(Tim::LOG_DIR,
765
765
  "\#{self[:product]}_%Y-%m-%d_%H-%M-%S.log"))
@@ -767,7 +767,7 @@ INDENT_OK[:paren_comma_combo1] =
767
767
  handle_arguments arg_list
768
768
  end}
769
769
 
770
- INDENT_OK[:line_ends_with_label] =
770
+ INDENT_OK['line_ends_with_label'] =
771
771
  %Q{options = {
772
772
  actual_trailing_spaces:
773
773
  lexed_line.last_non_line_feed_event.last.size