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
@@ -5,13 +5,13 @@ require 'tailor/configuration/style'
5
5
 
6
6
 
7
7
  TRAILING_WHITESPACE = {}
8
- TRAILING_WHITESPACE[:empty_line_with_spaces] = %Q{ }
9
- TRAILING_WHITESPACE[:empty_line_with_spaces_in_method] = %Q{def thing
8
+ TRAILING_WHITESPACE['empty_line_with_spaces'] = %Q{ }
9
+ TRAILING_WHITESPACE['empty_line_with_spaces_in_method'] = %Q{def thing
10
10
 
11
11
  puts 'something'
12
12
  end}
13
13
 
14
- TRAILING_WHITESPACE[:trailing_spaces_on_def] = %Q{def thing
14
+ TRAILING_WHITESPACE['trailing_spaces_on_def'] = %Q{def thing
15
15
  puts 'something'
16
16
  end}
17
17
 
@@ -19,8 +19,8 @@ describe "Trailing whitespace detection" do
19
19
  before do
20
20
  Tailor::Logger.stub(:log)
21
21
  FakeFS.activate!
22
- File.open(file_name.to_s, 'w') { |f| f.write contents }
23
- critic.check_file(file_name.to_s, style.to_hash)
22
+ File.open(file_name, 'w') { |f| f.write contents }
23
+ critic.check_file(file_name, style.to_hash)
24
24
  end
25
25
 
26
26
  let(:critic) do
@@ -38,29 +38,29 @@ describe "Trailing whitespace detection" do
38
38
  end
39
39
 
40
40
  context "line is empty spaces" do
41
- let(:file_name) { :empty_line_with_spaces }
42
- specify { critic.problems[file_name.to_s].size.should be 1 }
43
- specify { critic.problems[file_name.to_s].first[:type].should == "allow_trailing_line_spaces" }
44
- specify { critic.problems[file_name.to_s].first[:line].should be 1 }
45
- specify { critic.problems[file_name.to_s].first[:column].should be 2 }
46
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
41
+ let(:file_name) { 'empty_line_with_spaces' }
42
+ specify { critic.problems[file_name].size.should be 1 }
43
+ specify { critic.problems[file_name].first[:type].should == "allow_trailing_line_spaces" }
44
+ specify { critic.problems[file_name].first[:line].should be 1 }
45
+ specify { critic.problems[file_name].first[:column].should be 2 }
46
+ specify { critic.problems[file_name].first[:level].should be :error }
47
47
  end
48
48
 
49
49
  context "method contains an empty line with spaces" do
50
- let(:file_name) { :empty_line_with_spaces_in_method }
51
- specify { critic.problems[file_name.to_s].size.should be 1 }
52
- specify { critic.problems[file_name.to_s].first[:type].should == "allow_trailing_line_spaces" }
53
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
54
- specify { critic.problems[file_name.to_s].first[:column].should be 2 }
55
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
50
+ let(:file_name) { 'empty_line_with_spaces_in_method' }
51
+ specify { critic.problems[file_name].size.should be 1 }
52
+ specify { critic.problems[file_name].first[:type].should == "allow_trailing_line_spaces" }
53
+ specify { critic.problems[file_name].first[:line].should be 2 }
54
+ specify { critic.problems[file_name].first[:column].should be 2 }
55
+ specify { critic.problems[file_name].first[:level].should be :error }
56
56
  end
57
57
 
58
58
  context "def line ends with spaces" do
59
- let(:file_name) { :trailing_spaces_on_def }
60
- specify { critic.problems[file_name.to_s].size.should be 1 }
61
- specify { critic.problems[file_name.to_s].first[:type].should == "allow_trailing_line_spaces" }
62
- specify { critic.problems[file_name.to_s].first[:line].should be 1 }
63
- specify { critic.problems[file_name.to_s].first[:column].should be 11 }
64
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
59
+ let(:file_name) { 'trailing_spaces_on_def' }
60
+ specify { critic.problems[file_name].size.should be 1 }
61
+ specify { critic.problems[file_name].first[:type].should == "allow_trailing_line_spaces" }
62
+ specify { critic.problems[file_name].first[:line].should be 1 }
63
+ specify { critic.problems[file_name].first[:column].should be 11 }
64
+ specify { critic.problems[file_name].first[:level].should be :error }
65
65
  end
66
66
  end
@@ -23,22 +23,22 @@ describe "Horizontal Space problem detection" do
23
23
 
24
24
  H_SPACING_OK.each do |file_name, contents|
25
25
  before do
26
- FileUtils.touch file_name.to_s
27
- File.open(file_name.to_s, 'w') { |f| f.write contents }
26
+ FileUtils.touch file_name
27
+ File.open(file_name, 'w') { |f| f.write contents }
28
28
  end
29
29
 
30
30
  it "should be OK" do
31
- critic.check_file(file_name.to_s, style.to_hash)
32
- critic.problems.should == { file_name.to_s => [] }
31
+ critic.check_file(file_name, style.to_hash)
32
+ critic.problems.should == { file_name => [] }
33
33
  end
34
34
  end
35
35
 
36
36
  context "line ends with a backslash" do
37
- let(:file_name) { :line_split_by_backslash }
37
+ let(:file_name) { 'line_split_by_backslash' }
38
38
 
39
39
  before do
40
- FileUtils.touch file_name.to_s
41
- File.open(file_name.to_s, 'w') { |f| f.write contents }
40
+ FileUtils.touch file_name
41
+ File.open(file_name, 'w') { |f| f.write contents }
42
42
  end
43
43
 
44
44
  context "no problems" do
@@ -51,8 +51,8 @@ end}
51
51
  end
52
52
 
53
53
  it "is OK" do
54
- critic.check_file(file_name.to_s, style.to_hash)
55
- critic.problems.should == { file_name.to_s => [] }
54
+ critic.check_file(file_name, style.to_hash)
55
+ critic.problems.should == { file_name => [] }
56
56
  end
57
57
  end
58
58
 
@@ -66,9 +66,9 @@ end}
66
66
  end
67
67
 
68
68
  it "is OK" do
69
- critic.check_file(file_name.to_s, style.to_hash)
69
+ critic.check_file(file_name, style.to_hash)
70
70
  critic.problems.should == {
71
- file_name.to_s => [
71
+ file_name => [
72
72
  {
73
73
  :type => "max_line_length",
74
74
  :line => 3,
@@ -8,8 +8,8 @@ describe "Detection of method length" do
8
8
  before do
9
9
  Tailor::Logger.stub(:log)
10
10
  FakeFS.activate!
11
- File.open(file_name.to_s, 'w') { |f| f.write contents }
12
- critic.check_file(file_name.to_s, style.to_hash)
11
+ File.open(file_name, 'w') { |f| f.write contents }
12
+ critic.check_file(file_name, style.to_hash)
13
13
  end
14
14
 
15
15
  let(:critic) do
@@ -28,343 +28,340 @@ describe "Detection of method length" do
28
28
 
29
29
  context "simple classes" do
30
30
  context "empty with an indented end" do
31
- let(:file_name) { :class_indented_end }
32
- specify { critic.problems[file_name.to_s].size.should be 1 }
33
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
34
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
35
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
36
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
31
+ let(:file_name) { 'class_indented_end' }
32
+ specify { critic.problems[file_name].size.should be 1 }
33
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
34
+ specify { critic.problems[file_name].first[:line].should be 2 }
35
+ specify { critic.problems[file_name].first[:column].should be 1 }
36
+ specify { critic.problems[file_name].first[:level].should be :error }
37
37
  end
38
38
 
39
39
  context "body extra indented" do
40
- let(:file_name) { :class_indented_single_statement }
41
- specify { critic.problems[file_name.to_s].size.should be 1 }
42
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
43
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
44
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
45
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
40
+ let(:file_name) { 'class_indented_single_statement' }
41
+ specify { critic.problems[file_name].size.should be 1 }
42
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
43
+ specify { critic.problems[file_name].first[:line].should be 2 }
44
+ specify { critic.problems[file_name].first[:column].should be 3 }
45
+ specify { critic.problems[file_name].first[:level].should be :error }
46
46
  end
47
47
 
48
48
  context "body extra indented, trailing comment" do
49
- let(:file_name) { :class_indented_single_statement_trailing_comment }
50
- specify { critic.problems[file_name.to_s].size.should be 1 }
51
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
52
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
53
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
54
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
49
+ let(:file_name) { 'class_indented_single_statement_trailing_comment' }
50
+ specify { critic.problems[file_name].size.should be 1 }
51
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
52
+ specify { critic.problems[file_name].first[:line].should be 2 }
53
+ specify { critic.problems[file_name].first[:column].should be 3 }
54
+ specify { critic.problems[file_name].first[:level].should be :error }
55
55
  end
56
56
 
57
57
  context "body extra outdented" do
58
- let(:file_name) { :class_outdented_single_statement }
59
- specify { critic.problems[file_name.to_s].size.should be 1 }
60
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
61
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
62
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
63
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
58
+ let(:file_name) { 'class_outdented_single_statement' }
59
+ specify { critic.problems[file_name].size.should be 1 }
60
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
61
+ specify { critic.problems[file_name].first[:line].should be 2 }
62
+ specify { critic.problems[file_name].first[:column].should be 1 }
63
+ specify { critic.problems[file_name].first[:level].should be :error }
64
64
  end
65
65
  end
66
66
 
67
67
  context "simple methods" do
68
68
  context "empty with an indented end" do
69
- let(:file_name) { :def_indented_end }
70
- specify { critic.problems[file_name.to_s].size.should be 1 }
71
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
72
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
73
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
74
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
69
+ let(:file_name) { 'def_indented_end' }
70
+ specify { critic.problems[file_name].size.should be 1 }
71
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
72
+ specify { critic.problems[file_name].first[:line].should be 2 }
73
+ specify { critic.problems[file_name].first[:column].should be 1 }
74
+ specify { critic.problems[file_name].first[:level].should be :error }
75
75
  end
76
76
 
77
77
  context "body and end extra indented" do
78
- let(:file_name) { :def_content_indented_end }
79
- specify { critic.problems[file_name.to_s].size.should be 1 }
80
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
81
- specify { critic.problems[file_name.to_s].first[:line].should be 3 }
82
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
83
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
78
+ let(:file_name) { 'def_content_indented_end' }
79
+ specify { critic.problems[file_name].size.should be 1 }
80
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
81
+ specify { critic.problems[file_name].first[:line].should be 3 }
82
+ specify { critic.problems[file_name].first[:column].should be 1 }
83
+ specify { critic.problems[file_name].first[:level].should be :error }
84
84
  end
85
85
 
86
86
  context "in a class, end outdented" do
87
- let(:file_name) { :class_def_content_outdented_end }
88
- specify { critic.problems[file_name.to_s].size.should be 1 }
89
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
90
- specify { critic.problems[file_name.to_s].first[:line].should be 4 }
91
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
92
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
87
+ let(:file_name) { 'class_def_content_outdented_end' }
88
+ specify { critic.problems[file_name].size.should be 1 }
89
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
90
+ specify { critic.problems[file_name].first[:line].should be 4 }
91
+ specify { critic.problems[file_name].first[:column].should be 1 }
92
+ specify { critic.problems[file_name].first[:level].should be :error }
93
93
  end
94
94
 
95
95
  context "in a class, body outdented" do
96
- let(:file_name) { :class_def_outdented_content }
97
- specify { critic.problems[file_name.to_s].size.should be 1 }
98
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
99
- specify { critic.problems[file_name.to_s].first[:line].should be 3 }
100
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
101
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
96
+ let(:file_name) { 'class_def_outdented_content' }
97
+ specify { critic.problems[file_name].size.should be 1 }
98
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
99
+ specify { critic.problems[file_name].first[:line].should be 3 }
100
+ specify { critic.problems[file_name].first[:column].should be 3 }
101
+ specify { critic.problems[file_name].first[:level].should be :error }
102
102
  end
103
103
 
104
104
  context "class method outdented, in a class" do
105
- let(:file_name) { :class_method_def_using_self_outdented }
106
-
107
- specify do
108
- critic.problems[file_name.to_s].size.should be 1
109
- end
110
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
111
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
112
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
113
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
105
+ let(:file_name) { 'class_method_def_using_self_outdented' }
106
+ specify { critic.problems[file_name].size.should be 1 }
107
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
108
+ specify { critic.problems[file_name].first[:line].should be 2 }
109
+ specify { critic.problems[file_name].first[:column].should be 1 }
110
+ specify { critic.problems[file_name].first[:level].should be :error }
114
111
  end
115
112
  end
116
113
 
117
114
  context "case statements" do
118
115
  context "case extra indented" do
119
- let(:file_name) { :case_indented_whens_level }
120
- specify { critic.problems[file_name.to_s].size.should be 1 }
121
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
122
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
123
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
124
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
116
+ let(:file_name) { 'case_indented_whens_level' }
117
+ specify { critic.problems[file_name].size.should be 1 }
118
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
119
+ specify { critic.problems[file_name].first[:line].should be 2 }
120
+ specify { critic.problems[file_name].first[:column].should be 3 }
121
+ specify { critic.problems[file_name].first[:level].should be :error }
125
122
  end
126
123
 
127
124
  context "case extra indented, trailing comment" do
128
- let(:file_name) { :case_indented_whens_level_trailing_comment }
129
- specify { critic.problems[file_name.to_s].size.should be 1 }
130
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
131
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
132
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
133
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
125
+ let(:file_name) { 'case_indented_whens_level_trailing_comment' }
126
+ specify { critic.problems[file_name].size.should be 1 }
127
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
128
+ specify { critic.problems[file_name].first[:line].should be 2 }
129
+ specify { critic.problems[file_name].first[:column].should be 3 }
130
+ specify { critic.problems[file_name].first[:level].should be :error }
134
131
  end
135
132
 
136
133
  context "case extra outdented" do
137
- let(:file_name) { :case_outdented_whens_level }
138
- specify { critic.problems[file_name.to_s].size.should be 1 }
139
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
140
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
141
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
142
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
134
+ let(:file_name) { 'case_outdented_whens_level' }
135
+ specify { critic.problems[file_name].size.should be 1 }
136
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
137
+ specify { critic.problems[file_name].first[:line].should be 2 }
138
+ specify { critic.problems[file_name].first[:column].should be 1 }
139
+ specify { critic.problems[file_name].first[:level].should be :error }
143
140
  end
144
141
 
145
142
  context "when extra intdented" do
146
- let(:file_name) { :case_when_indented_whens_level }
147
- specify { critic.problems[file_name.to_s].size.should be 1 }
148
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
149
- specify { critic.problems[file_name.to_s].first[:line].should be 3 }
150
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
151
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
143
+ let(:file_name) { 'case_when_indented_whens_level' }
144
+ specify { critic.problems[file_name].size.should be 1 }
145
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
146
+ specify { critic.problems[file_name].first[:line].should be 3 }
147
+ specify { critic.problems[file_name].first[:column].should be 3 }
148
+ specify { critic.problems[file_name].first[:level].should be :error }
152
149
  end
153
150
 
154
151
  context "when extra outdented" do
155
- let(:file_name) { :case_when_outdented_whens_level }
156
- specify { critic.problems[file_name.to_s].size.should be 1 }
157
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
158
- specify { critic.problems[file_name.to_s].first[:line].should be 3 }
159
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
160
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
152
+ let(:file_name) { 'case_when_outdented_whens_level' }
153
+ specify { critic.problems[file_name].size.should be 1 }
154
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
155
+ specify { critic.problems[file_name].first[:line].should be 3 }
156
+ specify { critic.problems[file_name].first[:column].should be 1 }
157
+ specify { critic.problems[file_name].first[:level].should be :error }
161
158
  end
162
159
 
163
160
  context "case extra indented" do
164
161
  pending "Implementation of option to allow whens in"
165
162
 
166
163
  =begin
167
- let(:file_name) { :case_indented_whens_in }
168
- specify { critic.problems[file_name.to_s].size.should be 1 }
169
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
170
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
171
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
172
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
164
+ let(:file_name) { 'case_indented_whens_in' }
165
+ specify { critic.problems[file_name].size.should be 1 }
166
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
167
+ specify { critic.problems[file_name].first[:line].should be 2 }
168
+ specify { critic.problems[file_name].first[:column].should be 1 }
169
+ specify { critic.problems[file_name].first[:level].should be :error }
173
170
  =end
174
171
  end
175
172
  end
176
173
 
177
174
  context "while/do loops" do
178
175
  context "while/do indented" do
179
- let(:file_name) { :while_do_indented }
180
- specify { critic.problems[file_name.to_s].size.should be 1 }
181
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
182
- specify { critic.problems[file_name.to_s].first[:line].should be 1 }
183
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
184
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
176
+ let(:file_name) { 'while_do_indented' }
177
+ specify { critic.problems[file_name].size.should be 1 }
178
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
179
+ specify { critic.problems[file_name].first[:line].should be 1 }
180
+ specify { critic.problems[file_name].first[:column].should be 1 }
181
+ specify { critic.problems[file_name].first[:level].should be :error }
185
182
  end
186
183
 
187
184
  context "while/do outdented" do
188
- let(:file_name) { :while_do_outdented }
189
- specify { critic.problems[file_name.to_s].size.should be 1 }
190
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
191
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
192
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
193
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
185
+ let(:file_name) { 'while_do_outdented' }
186
+ specify { critic.problems[file_name].size.should be 1 }
187
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
188
+ specify { critic.problems[file_name].first[:line].should be 2 }
189
+ specify { critic.problems[file_name].first[:column].should be 1 }
190
+ specify { critic.problems[file_name].first[:level].should be :error }
194
191
  end
195
192
 
196
193
  context "while/do content outdented" do
197
- let(:file_name) { :while_do_content_outdented }
198
- specify { critic.problems[file_name.to_s].size.should be 1 }
199
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
200
- specify { critic.problems[file_name.to_s].first[:line].should be 3 }
201
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
202
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
194
+ let(:file_name) { 'while_do_content_outdented' }
195
+ specify { critic.problems[file_name].size.should be 1 }
196
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
197
+ specify { critic.problems[file_name].first[:line].should be 3 }
198
+ specify { critic.problems[file_name].first[:column].should be 3 }
199
+ specify { critic.problems[file_name].first[:level].should be :error }
203
200
  end
204
201
 
205
202
  context "while/do content indented" do
206
- let(:file_name) { :while_do_content_indented }
207
- specify { critic.problems[file_name.to_s].size.should be 1 }
208
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
209
- specify { critic.problems[file_name.to_s].first[:line].should be 3 }
210
- specify { critic.problems[file_name.to_s].first[:column].should be 5 }
211
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
203
+ let(:file_name) { 'while_do_content_indented' }
204
+ specify { critic.problems[file_name].size.should be 1 }
205
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
206
+ specify { critic.problems[file_name].first[:line].should be 3 }
207
+ specify { critic.problems[file_name].first[:column].should be 5 }
208
+ specify { critic.problems[file_name].first[:level].should be :error }
212
209
  end
213
210
 
214
211
  context "another while/do indented" do
215
- let(:file_name) { :while_do_indented2 }
216
- specify { critic.problems[file_name.to_s].size.should be 1 }
217
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
218
- specify { critic.problems[file_name.to_s].first[:line].should be 4 }
219
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
220
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
212
+ let(:file_name) { 'while_do_indented2' }
213
+ specify { critic.problems[file_name].size.should be 1 }
214
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
215
+ specify { critic.problems[file_name].first[:line].should be 4 }
216
+ specify { critic.problems[file_name].first[:column].should be 1 }
217
+ specify { critic.problems[file_name].first[:level].should be :error }
221
218
  end
222
219
 
223
220
  context "another while/do indented, trailing comment" do
224
- let(:file_name) { :while_do_indented2_trailing_comment }
225
- specify { critic.problems[file_name.to_s].size.should be 1 }
226
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
227
- specify { critic.problems[file_name.to_s].first[:line].should be 4 }
228
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
229
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
221
+ let(:file_name) { 'while_do_indented2_trailing_comment' }
222
+ specify { critic.problems[file_name].size.should be 1 }
223
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
224
+ specify { critic.problems[file_name].first[:line].should be 4 }
225
+ specify { critic.problems[file_name].first[:column].should be 1 }
226
+ specify { critic.problems[file_name].first[:level].should be :error }
230
227
  end
231
228
  end
232
229
 
233
230
  context "until/do loops" do
234
231
  context "until indented" do
235
- let(:file_name) { :until_do_indented }
236
- specify { critic.problems[file_name.to_s].size.should be 1 }
237
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
238
- specify { critic.problems[file_name.to_s].first[:line].should be 4 }
239
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
240
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
232
+ let(:file_name) { 'until_do_indented' }
233
+ specify { critic.problems[file_name].size.should be 1 }
234
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
235
+ specify { critic.problems[file_name].first[:line].should be 4 }
236
+ specify { critic.problems[file_name].first[:column].should be 1 }
237
+ specify { critic.problems[file_name].first[:level].should be :error }
241
238
  end
242
239
  end
243
240
 
244
241
  context "for/do loops" do
245
242
  context "for indented" do
246
- let(:file_name) { :for_do_indented }
247
- specify { critic.problems[file_name.to_s].size.should be 1 }
248
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
249
- specify { critic.problems[file_name.to_s].first[:line].should be 1 }
250
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
251
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
243
+ let(:file_name) { 'for_do_indented' }
244
+ specify { critic.problems[file_name].size.should be 1 }
245
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
246
+ specify { critic.problems[file_name].first[:line].should be 1 }
247
+ specify { critic.problems[file_name].first[:column].should be 1 }
248
+ specify { critic.problems[file_name].first[:level].should be :error }
252
249
  end
253
250
  end
254
251
 
255
252
  context "loop/do loops" do
256
253
  context "loop indented" do
257
- let(:file_name) { :loop_do_indented }
258
- specify { critic.problems[file_name.to_s].size.should be 1 }
259
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
260
- specify { critic.problems[file_name.to_s].first[:line].should be 1 }
261
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
262
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
254
+ let(:file_name) { 'loop_do_indented' }
255
+ specify { critic.problems[file_name].size.should be 1 }
256
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
257
+ specify { critic.problems[file_name].first[:line].should be 1 }
258
+ specify { critic.problems[file_name].first[:column].should be 1 }
259
+ specify { critic.problems[file_name].first[:level].should be :error }
263
260
  end
264
261
  end
265
262
 
266
263
  context "if statements" do
267
264
  context "first line extra indented" do
268
- let(:file_name) { :if_line_indented }
269
- specify { critic.problems[file_name.to_s].size.should be 1 }
270
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
271
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
272
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
273
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
265
+ let(:file_name) { 'if_line_indented' }
266
+ specify { critic.problems[file_name].size.should be 1 }
267
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
268
+ specify { critic.problems[file_name].first[:line].should be 2 }
269
+ specify { critic.problems[file_name].first[:column].should be 3 }
270
+ specify { critic.problems[file_name].first[:level].should be :error }
274
271
  end
275
272
 
276
273
  context "first line extra indented, trailing comment" do
277
- let(:file_name) { :if_line_indented_trailing_comment }
278
- specify { critic.problems[file_name.to_s].size.should be 1 }
279
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
280
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
281
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
282
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
274
+ let(:file_name) { 'if_line_indented_trailing_comment' }
275
+ specify { critic.problems[file_name].size.should be 1 }
276
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
277
+ specify { critic.problems[file_name].first[:line].should be 2 }
278
+ specify { critic.problems[file_name].first[:column].should be 3 }
279
+ specify { critic.problems[file_name].first[:level].should be :error }
283
280
  end
284
281
  end
285
282
 
286
283
  context "multi_line_tstring" do
287
- let(:file_name) { :multi_line_tstring }
288
- specify { critic.problems[file_name.to_s].size.should be 1 }
289
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
290
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
291
- specify { critic.problems[file_name.to_s].first[:column].should be 0 }
292
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
284
+ let(:file_name) { 'multi_line_tstring' }
285
+ specify { critic.problems[file_name].size.should be 1 }
286
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
287
+ specify { critic.problems[file_name].first[:line].should be 2 }
288
+ specify { critic.problems[file_name].first[:column].should be 0 }
289
+ specify { critic.problems[file_name].first[:level].should be :error }
293
290
  end
294
291
 
295
292
  context "operators" do
296
293
  context "multi-line &&, first line indented" do
297
- let(:file_name) { :multi_line_andop_first_line_indented }
298
- specify { critic.problems[file_name.to_s].size.should be 1 }
299
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
300
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
301
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
302
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
294
+ let(:file_name) { 'multi_line_andop_first_line_indented' }
295
+ specify { critic.problems[file_name].size.should be 1 }
296
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
297
+ specify { critic.problems[file_name].first[:line].should be 2 }
298
+ specify { critic.problems[file_name].first[:column].should be 3 }
299
+ specify { critic.problems[file_name].first[:level].should be :error }
303
300
  end
304
301
 
305
302
  context "multi-line &&, first line indented, trailing comment" do
306
- let(:file_name) { :multi_line_andop_first_line_indented_trailing_comment }
307
- specify { critic.problems[file_name.to_s].size.should be 1 }
308
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
309
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
310
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
311
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
303
+ let(:file_name) { 'multi_line_andop_first_line_indented_trailing_comment' }
304
+ specify { critic.problems[file_name].size.should be 1 }
305
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
306
+ specify { critic.problems[file_name].first[:line].should be 2 }
307
+ specify { critic.problems[file_name].first[:column].should be 3 }
308
+ specify { critic.problems[file_name].first[:level].should be :error }
312
309
  end
313
310
 
314
311
  context "multi-line &&, second line indented" do
315
- let(:file_name) { :multi_line_andop_second_line_indented }
316
- specify { critic.problems[file_name.to_s].size.should be 1 }
317
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
318
- specify { critic.problems[file_name.to_s].first[:line].should be 3 }
319
- specify { critic.problems[file_name.to_s].first[:column].should be 5 }
320
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
312
+ let(:file_name) { 'multi_line_andop_second_line_indented' }
313
+ specify { critic.problems[file_name].size.should be 1 }
314
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
315
+ specify { critic.problems[file_name].first[:line].should be 3 }
316
+ specify { critic.problems[file_name].first[:column].should be 5 }
317
+ specify { critic.problems[file_name].first[:level].should be :error }
321
318
  end
322
319
 
323
320
  context "multi-line string concat, second line outdented" do
324
- let(:file_name) { :multi_line_string_concat_with_plus_out }
325
- specify { critic.problems[file_name.to_s].size.should be 1 }
326
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
327
- specify { critic.problems[file_name.to_s].first[:line].should be 2 }
328
- specify { critic.problems[file_name.to_s].first[:column].should be 1 }
329
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
321
+ let(:file_name) { 'multi_line_string_concat_with_plus_out' }
322
+ specify { critic.problems[file_name].size.should be 1 }
323
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
324
+ specify { critic.problems[file_name].first[:line].should be 2 }
325
+ specify { critic.problems[file_name].first[:column].should be 1 }
326
+ specify { critic.problems[file_name].first[:level].should be :error }
330
327
  end
331
328
  end
332
329
 
333
330
  context "combinations of stuff" do
334
331
  context "multi-line if with end in" do
335
- let(:file_name) { :multi_line_method_call_end_in }
336
- specify { critic.problems[file_name.to_s].size.should be 1 }
337
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
338
- specify { critic.problems[file_name.to_s].first[:line].should be 5 }
339
- specify { critic.problems[file_name.to_s].first[:column].should be 3 }
340
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
332
+ let(:file_name) { 'multi_line_method_call_end_in' }
333
+ specify { critic.problems[file_name].size.should be 1 }
334
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
335
+ specify { critic.problems[file_name].first[:line].should be 5 }
336
+ specify { critic.problems[file_name].first[:column].should be 3 }
337
+ specify { critic.problems[file_name].first[:level].should be :error }
341
338
  end
342
339
 
343
340
  context "multi-line chained methods with 2nd line in" do
344
- let(:file_name) { :multi_line_method_call_ends_with_period_2nd_line_in }
345
- specify { critic.problems[file_name.to_s].size.should be 1 }
346
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
347
- specify { critic.problems[file_name.to_s].first[:line].should be 4 }
348
- specify { critic.problems[file_name.to_s].first[:column].should be 5 }
349
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
341
+ let(:file_name) { 'multi_line_method_call_ends_with_period_2nd_line_in' }
342
+ specify { critic.problems[file_name].size.should be 1 }
343
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
344
+ specify { critic.problems[file_name].first[:line].should be 4 }
345
+ specify { critic.problems[file_name].first[:column].should be 5 }
346
+ specify { critic.problems[file_name].first[:level].should be :error }
350
347
  end
351
348
 
352
349
  context "multi-line chained methods with 3rd line in" do
353
- let(:file_name) { :multi_line_method_call_ends_with_many_periods_last_in }
354
- specify { critic.problems[file_name.to_s].size.should be 1 }
355
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
356
- specify { critic.problems[file_name.to_s].first[:line].should be 3 }
357
- specify { critic.problems[file_name.to_s].first[:column].should be 4 }
358
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
350
+ let(:file_name) { 'multi_line_method_call_ends_with_many_periods_last_in' }
351
+ specify { critic.problems[file_name].size.should be 1 }
352
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
353
+ specify { critic.problems[file_name].first[:line].should be 3 }
354
+ specify { critic.problems[file_name].first[:column].should be 4 }
355
+ specify { critic.problems[file_name].first[:level].should be :error }
359
356
  end
360
357
 
361
358
  context "multi-line chained methods with 3rd line in, trailing comment" do
362
- let(:file_name) { :multi_line_method_call_ends_with_many_periods_last_in_trailing_comment }
363
- specify { critic.problems[file_name.to_s].size.should be 1 }
364
- specify { critic.problems[file_name.to_s].first[:type].should == "indentation_spaces" }
365
- specify { critic.problems[file_name.to_s].first[:line].should be 3 }
366
- specify { critic.problems[file_name.to_s].first[:column].should be 4 }
367
- specify { critic.problems[file_name.to_s].first[:level].should be :error }
359
+ let(:file_name) { 'multi_line_method_call_ends_with_many_periods_last_in_trailing_comment' }
360
+ specify { critic.problems[file_name].size.should be 1 }
361
+ specify { critic.problems[file_name].first[:type].should == "indentation_spaces" }
362
+ specify { critic.problems[file_name].first[:line].should be 3 }
363
+ specify { critic.problems[file_name].first[:column].should be 4 }
364
+ specify { critic.problems[file_name].first[:level].should be :error }
368
365
  end
369
366
  end
370
367
  end