tailor 1.2.1 → 1.3.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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +30 -28
  3. data/History.md +257 -0
  4. data/README.md +486 -0
  5. data/Rakefile +1 -9
  6. data/lib/ext/string_ext.rb +1 -1
  7. data/lib/tailor/cli.rb +3 -1
  8. data/lib/tailor/cli/options.rb +59 -39
  9. data/lib/tailor/configuration.rb +8 -5
  10. data/lib/tailor/configuration/file_set.rb +1 -3
  11. data/lib/tailor/configuration/style.rb +2 -0
  12. data/lib/tailor/critic.rb +2 -2
  13. data/lib/tailor/formatters/text.rb +17 -16
  14. data/lib/tailor/lexed_line.rb +2 -4
  15. data/lib/tailor/lexer.rb +9 -9
  16. data/lib/tailor/lexer/lexer_constants.rb +32 -32
  17. data/lib/tailor/lexer/token.rb +8 -10
  18. data/lib/tailor/logger.rb +1 -1
  19. data/lib/tailor/problem.rb +4 -1
  20. data/lib/tailor/rake_task.rb +4 -1
  21. data/lib/tailor/reporter.rb +3 -3
  22. data/lib/tailor/ruler.rb +2 -2
  23. data/lib/tailor/rulers/allow_camel_case_methods_ruler.rb +2 -2
  24. data/lib/tailor/rulers/allow_hard_tabs_ruler.rb +1 -1
  25. data/lib/tailor/rulers/allow_invalid_ruby_ruler.rb +1 -1
  26. data/lib/tailor/rulers/allow_screaming_snake_case_classes_ruler.rb +2 -2
  27. data/lib/tailor/rulers/indentation_spaces_ruler.rb +24 -22
  28. data/lib/tailor/rulers/indentation_spaces_ruler/indentation_manager.rb +13 -13
  29. data/lib/tailor/rulers/max_code_lines_in_class_ruler.rb +2 -2
  30. data/lib/tailor/rulers/max_code_lines_in_method_ruler.rb +2 -2
  31. data/lib/tailor/rulers/spaces_after_comma_ruler.rb +6 -6
  32. data/lib/tailor/rulers/spaces_after_conditional_ruler.rb +48 -0
  33. data/lib/tailor/rulers/spaces_after_lbrace_ruler.rb +8 -8
  34. data/lib/tailor/rulers/spaces_after_lbracket_ruler.rb +6 -6
  35. data/lib/tailor/rulers/spaces_after_lparen_ruler.rb +6 -6
  36. data/lib/tailor/rulers/spaces_before_comma_ruler.rb +2 -2
  37. data/lib/tailor/rulers/spaces_before_lbrace_ruler.rb +4 -4
  38. data/lib/tailor/rulers/spaces_before_rbrace_ruler.rb +9 -9
  39. data/lib/tailor/rulers/spaces_before_rbracket_ruler.rb +6 -6
  40. data/lib/tailor/rulers/spaces_before_rparen_ruler.rb +6 -6
  41. data/lib/tailor/rulers/spaces_in_empty_braces_ruler.rb +1 -1
  42. data/lib/tailor/rulers/trailing_newlines_ruler.rb +2 -2
  43. data/lib/tailor/tailorrc.erb +1 -1
  44. data/lib/tailor/version.rb +1 -1
  45. data/spec/functional/conditional_spacing_spec.rb +149 -0
  46. data/spec/functional/configuration_spec.rb +36 -26
  47. data/spec/functional/horizontal_spacing/braces_spec.rb +1 -1
  48. data/spec/functional/horizontal_spacing/brackets_spec.rb +14 -14
  49. data/spec/functional/horizontal_spacing/comma_spacing_spec.rb +8 -8
  50. data/spec/functional/horizontal_spacing/hard_tabs_spec.rb +13 -13
  51. data/spec/functional/horizontal_spacing/long_lines_spec.rb +6 -6
  52. data/spec/functional/horizontal_spacing/long_methods_spec.rb +55 -0
  53. data/spec/functional/horizontal_spacing/parens_spec.rb +17 -17
  54. data/spec/functional/horizontal_spacing/trailing_whitespace_spec.rb +8 -8
  55. data/spec/functional/horizontal_spacing_spec.rb +11 -11
  56. data/spec/functional/indentation_spacing/bad_indentation_spec.rb +83 -83
  57. data/spec/functional/indentation_spacing_spec.rb +10 -10
  58. data/spec/functional/naming/camel_case_methods_spec.rb +6 -6
  59. data/spec/functional/naming/screaming_snake_case_classes_spec.rb +10 -10
  60. data/spec/functional/naming_spec.rb +3 -3
  61. data/spec/functional/vertical_spacing/class_length_spec.rb +6 -6
  62. data/spec/functional/vertical_spacing/method_length_spec.rb +6 -6
  63. data/spec/functional/vertical_spacing_spec.rb +3 -3
  64. data/spec/support/conditional_spacing_cases.rb +37 -0
  65. data/spec/support/good_indentation_cases.rb +1 -1
  66. data/spec/unit/tailor/cli/options_spec.rb +50 -0
  67. data/spec/unit/tailor/cli_spec.rb +3 -3
  68. data/spec/unit/tailor/composite_observable_spec.rb +8 -8
  69. data/spec/unit/tailor/configuration/file_set_spec.rb +2 -2
  70. data/spec/unit/tailor/configuration/style_spec.rb +30 -29
  71. data/spec/unit/tailor/configuration_spec.rb +39 -24
  72. data/spec/unit/tailor/critic_spec.rb +18 -17
  73. data/spec/unit/tailor/formatter_spec.rb +15 -15
  74. data/spec/unit/tailor/formatters/yaml_spec.rb +1 -1
  75. data/spec/unit/tailor/lexed_line_spec.rb +258 -258
  76. data/spec/unit/tailor/lexer/token_spec.rb +11 -11
  77. data/spec/unit/tailor/lexer_spec.rb +35 -35
  78. data/spec/unit/tailor/problem_spec.rb +13 -13
  79. data/spec/unit/tailor/reporter_spec.rb +19 -18
  80. data/spec/unit/tailor/ruler_spec.rb +15 -15
  81. data/spec/unit/tailor/rulers/indentation_spaces_ruler/indentation_manager_spec.rb +72 -72
  82. data/spec/unit/tailor/rulers/indentation_spaces_ruler_spec.rb +32 -32
  83. data/spec/unit/tailor/rulers/spaces_after_comma_ruler_spec.rb +8 -8
  84. data/spec/unit/tailor/rulers/spaces_after_lbrace_ruler_spec.rb +36 -36
  85. data/spec/unit/tailor/rulers/spaces_before_lbrace_ruler_spec.rb +14 -14
  86. data/spec/unit/tailor/rulers/spaces_before_rbrace_ruler_spec.rb +14 -14
  87. data/spec/unit/tailor/rulers_spec.rb +2 -2
  88. data/spec/unit/tailor/version_spec.rb +1 -1
  89. data/spec/unit/tailor_spec.rb +4 -4
  90. data/tailor.gemspec +1 -1
  91. metadata +16 -9
  92. data/History.rdoc +0 -189
  93. data/README.rdoc +0 -422
  94. data/spec/unit/tailor/options_spec.rb +0 -6
@@ -1,4 +1,4 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
  require 'tailor/configuration/style'
4
4
 
@@ -1,4 +1,4 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
  require 'tailor/configuration/style'
4
4
 
@@ -15,7 +15,7 @@ BRACKETS['two_d_array_space_before_rbrackets'] =
15
15
  %Q{[[1, 2, 3 ], [ 'a', 'b', 'c'] ]}
16
16
 
17
17
 
18
- describe "Detection of spaces around brackets" do
18
+ describe 'Detection of spaces around brackets' do
19
19
  before do
20
20
  Tailor::Logger.stub(:log)
21
21
  FakeFS.activate!
@@ -37,49 +37,49 @@ describe "Detection of spaces around brackets" do
37
37
  style
38
38
  end
39
39
 
40
- context "Arrays" do
41
- context "empty with space inside" do
40
+ context 'Arrays' do
41
+ context 'empty with space inside' do
42
42
  let(:file_name) { 'space_in_empty_array' }
43
43
  specify { critic.problems[file_name].size.should be 1 }
44
- specify { critic.problems[file_name].first[:type].should == "spaces_after_lbracket" }
44
+ specify { critic.problems[file_name].first[:type].should == 'spaces_after_lbracket' }
45
45
  specify { critic.problems[file_name].first[:line].should be 1 }
46
46
  specify { critic.problems[file_name].first[:column].should be 1 }
47
47
  specify { critic.problems[file_name].first[:level].should be :error }
48
48
  end
49
49
 
50
- context "space after lbracket" do
50
+ context 'space after lbracket' do
51
51
  let(:file_name) { 'simple_array_space_after_lbracket' }
52
52
  specify { critic.problems[file_name].size.should be 1 }
53
- specify { critic.problems[file_name].first[:type].should == "spaces_after_lbracket" }
53
+ specify { critic.problems[file_name].first[:type].should == 'spaces_after_lbracket' }
54
54
  specify { critic.problems[file_name].first[:line].should be 1 }
55
55
  specify { critic.problems[file_name].first[:column].should be 1 }
56
56
  specify { critic.problems[file_name].first[:level].should be :error }
57
57
  end
58
58
 
59
- context "space before rbracket" do
59
+ context 'space before rbracket' do
60
60
  let(:file_name) { 'simple_array_space_before_rbracket' }
61
61
  specify { critic.problems[file_name].size.should be 1 }
62
- specify { critic.problems[file_name].first[:type].should == "spaces_before_rbracket" }
62
+ specify { critic.problems[file_name].first[:type].should == 'spaces_before_rbracket' }
63
63
  specify { critic.problems[file_name].first[:line].should be 1 }
64
64
  specify { critic.problems[file_name].first[:column].should be 9 }
65
65
  specify { critic.problems[file_name].first[:level].should be :error }
66
66
  end
67
67
  end
68
68
 
69
- context "Hash key references" do
70
- context "space before rbracket" do
69
+ context 'Hash key references' do
70
+ context 'space before rbracket' do
71
71
  let(:file_name) { 'hash_key_ref_space_before_rbracket' }
72
72
  specify { critic.problems[file_name].size.should be 1 }
73
- specify { critic.problems[file_name].first[:type].should == "spaces_before_rbracket" }
73
+ specify { critic.problems[file_name].first[:type].should == 'spaces_before_rbracket' }
74
74
  specify { critic.problems[file_name].first[:line].should be 1 }
75
75
  specify { critic.problems[file_name].first[:column].should be 11 }
76
76
  specify { critic.problems[file_name].first[:level].should be :error }
77
77
  end
78
78
 
79
- context "space after lbracket" do
79
+ context 'space after lbracket' do
80
80
  let(:file_name) { 'hash_key_ref_space_after_lbracket' }
81
81
  specify { critic.problems[file_name].size.should be 1 }
82
- specify { critic.problems[file_name].first[:type].should == "spaces_after_lbracket" }
82
+ specify { critic.problems[file_name].first[:type].should == 'spaces_after_lbracket' }
83
83
  specify { critic.problems[file_name].first[:line].should be 1 }
84
84
  specify { critic.problems[file_name].first[:column].should be 6 }
85
85
  specify { critic.problems[file_name].first[:level].should be :error }
@@ -1,4 +1,4 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
  require 'tailor/configuration/style'
4
4
 
@@ -17,7 +17,7 @@ COMMA_SPACING['spaces_before_with_trailing_comments'] = %Q{[
17
17
  }
18
18
 
19
19
 
20
- describe "Spacing around comma detection" do
20
+ describe 'Spacing around comma detection' do
21
21
  before do
22
22
  Tailor::Logger.stub(:log)
23
23
  FakeFS.activate!
@@ -39,28 +39,28 @@ describe "Spacing around comma detection" do
39
39
  style
40
40
  end
41
41
 
42
- context "no space after a comma" do
42
+ context 'no space after a comma' do
43
43
  let(:file_name) { 'no_space_after_comma' }
44
44
  specify { critic.problems[file_name].size.should be 1 }
45
- specify { critic.problems[file_name].first[:type].should == "spaces_after_comma" }
45
+ specify { critic.problems[file_name].first[:type].should == 'spaces_after_comma' }
46
46
  specify { critic.problems[file_name].first[:line].should be 1 }
47
47
  specify { critic.problems[file_name].first[:column].should be 3 }
48
48
  specify { critic.problems[file_name].first[:level].should be :error }
49
49
  end
50
50
 
51
- context "two spaces after a comma" do
51
+ context 'two spaces after a comma' do
52
52
  let(:file_name) { 'two_spaces_after_comma' }
53
53
  specify { critic.problems[file_name].size.should be 1 }
54
- specify { critic.problems[file_name].first[:type].should == "spaces_after_comma" }
54
+ specify { critic.problems[file_name].first[:type].should == 'spaces_after_comma' }
55
55
  specify { critic.problems[file_name].first[:line].should be 1 }
56
56
  specify { critic.problems[file_name].first[:column].should be 3 }
57
57
  specify { critic.problems[file_name].first[:level].should be :error }
58
58
  end
59
59
 
60
- context "one space before comma" do
60
+ context 'one space before comma' do
61
61
  let(:file_name) { 'one_space_before_comma' }
62
62
  specify { critic.problems[file_name].size.should be 1 }
63
- specify { critic.problems[file_name].first[:type].should == "spaces_before_comma" }
63
+ specify { critic.problems[file_name].first[:type].should == 'spaces_before_comma' }
64
64
  specify { critic.problems[file_name].first[:line].should be 1 }
65
65
  specify { critic.problems[file_name].first[:column].should be 2 }
66
66
  specify { critic.problems[file_name].first[:level].should be :error }
@@ -1,4 +1,4 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
  require 'tailor/configuration/style'
4
4
 
@@ -38,7 +38,7 @@ HARD_TABS['hard_tab_with_2_indented_spaces'] =
38
38
  end
39
39
  end}
40
40
 
41
- describe "Hard tab detection" do
41
+ describe 'Hard tab detection' do
42
42
  before do
43
43
  Tailor::Logger.stub(:log)
44
44
  FakeFS.activate!
@@ -60,49 +60,49 @@ describe "Hard tab detection" do
60
60
  style
61
61
  end
62
62
 
63
- context "1 hard tab" do
63
+ context '1 hard tab' do
64
64
  let(:file_name) { 'hard_tab' }
65
65
  specify { critic.problems[file_name].size.should be 2 }
66
- specify { critic.problems[file_name].first[:type].should == "allow_hard_tabs" }
66
+ specify { critic.problems[file_name].first[:type].should == 'allow_hard_tabs' }
67
67
  specify { critic.problems[file_name].first[:line].should be 2 }
68
68
  specify { critic.problems[file_name].first[:column].should be 0 }
69
69
  specify { critic.problems[file_name].first[:level].should be :error }
70
- specify { critic.problems[file_name].last[:type].should == "indentation_spaces" }
70
+ specify { critic.problems[file_name].last[:type].should == 'indentation_spaces' }
71
71
  specify { critic.problems[file_name].last[:line].should be 2 }
72
72
  specify { critic.problems[file_name].last[:column].should be 1 }
73
73
  specify { critic.problems[file_name].last[:level].should be :error }
74
74
  end
75
75
 
76
- context "1 hard tab with 2 spaces after it" do
76
+ context '1 hard tab with 2 spaces after it' do
77
77
  let(:file_name) { 'hard_tab_with_spaces' }
78
78
  specify { critic.problems[file_name].size.should be 2 }
79
- specify { critic.problems[file_name].first[:type].should == "allow_hard_tabs" }
79
+ specify { critic.problems[file_name].first[:type].should == 'allow_hard_tabs' }
80
80
  specify { critic.problems[file_name].first[:line].should be 3 }
81
81
  specify { critic.problems[file_name].first[:column].should be 0 }
82
82
  specify { critic.problems[file_name].first[:level].should be :error }
83
- specify { critic.problems[file_name].last[:type].should == "indentation_spaces" }
83
+ specify { critic.problems[file_name].last[:type].should == 'indentation_spaces' }
84
84
  specify { critic.problems[file_name].last[:line].should be 3 }
85
85
  specify { critic.problems[file_name].last[:column].should be 3 }
86
86
  specify { critic.problems[file_name].last[:level].should be :error }
87
87
  end
88
88
 
89
- context "1 hard tab with 3 spaces after it" do
89
+ context '1 hard tab with 3 spaces after it' do
90
90
  let(:file_name) { 'hard_tab_with_1_indented_space' }
91
91
  specify { critic.problems[file_name].size.should be 1 }
92
- specify { critic.problems[file_name].first[:type].should == "allow_hard_tabs" }
92
+ specify { critic.problems[file_name].first[:type].should == 'allow_hard_tabs' }
93
93
  specify { critic.problems[file_name].first[:line].should be 3 }
94
94
  specify { critic.problems[file_name].first[:column].should be 0 }
95
95
  specify { critic.problems[file_name].first[:level].should be :error }
96
96
  end
97
97
 
98
- context "1 hard tab with 4 spaces after it" do
98
+ context '1 hard tab with 4 spaces after it' do
99
99
  let(:file_name) { 'hard_tab_with_2_indented_spaces' }
100
100
  specify { critic.problems[file_name].size.should be 2 }
101
- specify { critic.problems[file_name].first[:type].should == "allow_hard_tabs" }
101
+ specify { critic.problems[file_name].first[:type].should == 'allow_hard_tabs' }
102
102
  specify { critic.problems[file_name].first[:line].should be 3 }
103
103
  specify { critic.problems[file_name].first[:column].should be 0 }
104
104
  specify { critic.problems[file_name].first[:level].should be :error }
105
- specify { critic.problems[file_name].last[:type].should == "indentation_spaces" }
105
+ specify { critic.problems[file_name].last[:type].should == 'indentation_spaces' }
106
106
  specify { critic.problems[file_name].last[:line].should be 3 }
107
107
  specify { critic.problems[file_name].last[:column].should be 5 }
108
108
  specify { critic.problems[file_name].last[:level].should be :error }
@@ -1,4 +1,4 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
  require 'tailor/configuration/style'
4
4
 
@@ -9,7 +9,7 @@ LONG_LINE['long_line_newline_at_82'] = %Q{'#{'#' * 79}'
9
9
  }
10
10
 
11
11
 
12
- describe "Long line detection" do
12
+ describe 'Long line detection' do
13
13
  before do
14
14
  Tailor::Logger.stub(:log)
15
15
  FakeFS.activate!
@@ -31,19 +31,19 @@ describe "Long line detection" do
31
31
  style
32
32
  end
33
33
 
34
- context "line is 81 chars, no newline" do
34
+ context 'line is 81 chars, no newline' do
35
35
  let(:file_name) { 'long_line_no_newline' }
36
36
  specify { critic.problems[file_name].size.should be 1 }
37
- specify { critic.problems[file_name].first[:type].should == "max_line_length" }
37
+ specify { critic.problems[file_name].first[:type].should == 'max_line_length' }
38
38
  specify { critic.problems[file_name].first[:line].should be 1 }
39
39
  specify { critic.problems[file_name].first[:column].should be 81 }
40
40
  specify { critic.problems[file_name].first[:level].should be :error }
41
41
  end
42
42
 
43
- context "line is 81 chars, plus a newline" do
43
+ context 'line is 81 chars, plus a newline' do
44
44
  let(:file_name) { 'long_line_newline_at_82' }
45
45
  specify { critic.problems[file_name].size.should be 1 }
46
- specify { critic.problems[file_name].first[:type].should == "max_line_length" }
46
+ specify { critic.problems[file_name].first[:type].should == 'max_line_length' }
47
47
  specify { critic.problems[file_name].first[:line].should be 1 }
48
48
  specify { critic.problems[file_name].first[:column].should be 81 }
49
49
  specify { critic.problems[file_name].first[:level].should be :error }
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+ require 'tailor/critic'
3
+ require 'tailor/configuration/style'
4
+
5
+
6
+ LONG_METHOD_IN_CLASS = {}
7
+ LONG_METHOD_IN_CLASS['ok_with_equals'] = <<-METH
8
+ class Test
9
+ def method1
10
+ [1, 2, 3, 4].each do |uuid|
11
+ next if (@profiles[uuid].to_s.start_with? "SM" || @profiles[uuid] ==
12
+ :SystemLogger)
13
+ end
14
+ end
15
+
16
+ def method2
17
+ puts 'Do not ever get here.'
18
+ end
19
+ end
20
+ METH
21
+
22
+ describe 'Long method detection' do
23
+ before do
24
+ Tailor::Logger.stub(:log)
25
+ FakeFS.activate!
26
+ File.open('long_method.rb', 'w') { |f| f.write contents }
27
+ subject.check_file(file_name, style.to_hash)
28
+ end
29
+
30
+ subject do
31
+ Tailor::Critic.new
32
+ end
33
+
34
+ let(:contents) { LONG_METHOD_IN_CLASS[file_name] }
35
+
36
+ let(:style) do
37
+ style = Tailor::Configuration::Style.new
38
+ style.trailing_newlines 0, level: :off
39
+ style.indentation_spaces 2, level: :off
40
+ style.allow_invalid_ruby true, level: :off
41
+ style.max_code_lines_in_method 3
42
+
43
+ style
44
+ end
45
+
46
+ context 'methods are within limits' do
47
+ context 'method ends with line that ends with ==' do
48
+ let(:file_name) { 'ok_with_equals' }
49
+ specify {
50
+ pending 'https://github.com/turboladen/tailor/issues/112'
51
+
52
+ subject.problems[file_name].size.should be 1 }
53
+ end
54
+ end
55
+ end
@@ -1,4 +1,4 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
  require 'tailor/configuration/style'
4
4
 
@@ -17,7 +17,7 @@ PARENS['multi_line_method_call_space_after_lparen_trailing_comment'] =
17
17
  %Q{thing( one,
18
18
  two)}
19
19
 
20
- describe "Detection of spaces around brackets" do
20
+ describe 'Detection of spaces around brackets' do
21
21
  before do
22
22
  Tailor::Logger.stub(:log)
23
23
  FakeFS.activate!
@@ -39,61 +39,61 @@ describe "Detection of spaces around brackets" do
39
39
  style
40
40
  end
41
41
 
42
- context "methods" do
43
- context "space after lparen" do
42
+ context 'methods' do
43
+ context 'space after lparen' do
44
44
  let(:file_name) { 'simple_method_call_space_after_lparen' }
45
45
  specify { critic.problems[file_name].size.should be 1 }
46
- specify { critic.problems[file_name].first[:type].should == "spaces_after_lparen" }
46
+ specify { critic.problems[file_name].first[:type].should == 'spaces_after_lparen' }
47
47
  specify { critic.problems[file_name].first[:line].should be 1 }
48
48
  specify { critic.problems[file_name].first[:column].should be 6 }
49
49
  specify { critic.problems[file_name].first[:level].should be :error }
50
50
  end
51
51
 
52
- context "space before rparen" do
52
+ context 'space before rparen' do
53
53
  let(:file_name) { 'simple_method_call_space_before_rparen' }
54
54
  specify { critic.problems[file_name].size.should be 1 }
55
- specify { critic.problems[file_name].first[:type].should == "spaces_before_rparen" }
55
+ specify { critic.problems[file_name].first[:type].should == 'spaces_before_rparen' }
56
56
  specify { critic.problems[file_name].first[:line].should be 1 }
57
57
  specify { critic.problems[file_name].first[:column].should be 15 }
58
58
  specify { critic.problems[file_name].first[:level].should be :error }
59
59
  end
60
60
 
61
- context "space after lparen, trailing comment" do
61
+ context 'space after lparen, trailing comment' do
62
62
  let(:file_name) { 'method_call_space_after_lparen_trailing_comment' }
63
63
  specify { critic.problems[file_name].size.should be 1 }
64
- specify { critic.problems[file_name].first[:type].should == "spaces_after_lparen" }
64
+ specify { critic.problems[file_name].first[:type].should == 'spaces_after_lparen' }
65
65
  specify { critic.problems[file_name].first[:line].should be 1 }
66
66
  specify { critic.problems[file_name].first[:column].should be 6 }
67
67
  specify { critic.problems[file_name].first[:level].should be :error }
68
68
  end
69
69
 
70
- context "space after lparen, before rparen, trailing comment" do
70
+ context 'space after lparen, before rparen, trailing comment' do
71
71
  let(:file_name) { 'method_call_space_after_lparen_before_rparen_trailing_comment' }
72
72
  specify { critic.problems[file_name].size.should be 2 }
73
- specify { critic.problems[file_name].first[:type].should == "spaces_after_lparen" }
73
+ specify { critic.problems[file_name].first[:type].should == 'spaces_after_lparen' }
74
74
  specify { critic.problems[file_name].first[:line].should be 1 }
75
75
  specify { critic.problems[file_name].first[:column].should be 6 }
76
76
  specify { critic.problems[file_name].first[:level].should be :error }
77
- specify { critic.problems[file_name].last[:type].should == "spaces_before_rparen" }
77
+ specify { critic.problems[file_name].last[:type].should == 'spaces_before_rparen' }
78
78
  specify { critic.problems[file_name].last[:line].should be 1 }
79
79
  specify { critic.problems[file_name].last[:column].should be 16 }
80
80
  specify { critic.problems[file_name].last[:level].should be :error }
81
81
  end
82
82
  end
83
83
 
84
- context "multi-line method calls" do
85
- context "space after lparen" do
84
+ context 'multi-line method calls' do
85
+ context 'space after lparen' do
86
86
  let(:file_name) { 'multi_line_method_call_space_after_lparen' }
87
87
  specify { critic.problems[file_name].size.should be 1 }
88
- specify { critic.problems[file_name].first[:type].should == "spaces_after_lparen" }
88
+ specify { critic.problems[file_name].first[:type].should == 'spaces_after_lparen' }
89
89
  specify { critic.problems[file_name].first[:line].should be 1 }
90
90
  specify { critic.problems[file_name].first[:column].should be 6 }
91
91
  specify { critic.problems[file_name].first[:level].should be :error }
92
92
  end
93
- context "space after lparen, trailing comment" do
93
+ context 'space after lparen, trailing comment' do
94
94
  let(:file_name) { 'multi_line_method_call_space_after_lparen_trailing_comment' }
95
95
  specify { critic.problems[file_name].size.should be 1 }
96
- specify { critic.problems[file_name].first[:type].should == "spaces_after_lparen" }
96
+ specify { critic.problems[file_name].first[:type].should == 'spaces_after_lparen' }
97
97
  specify { critic.problems[file_name].first[:line].should be 1 }
98
98
  specify { critic.problems[file_name].first[:column].should be 6 }
99
99
  specify { critic.problems[file_name].first[:level].should be :error }
@@ -1,4 +1,4 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require_relative '../../support/horizontal_spacing_cases'
3
3
  require 'tailor/critic'
4
4
  require 'tailor/configuration/style'
@@ -15,7 +15,7 @@ TRAILING_WHITESPACE['trailing_spaces_on_def'] = %Q{def thing
15
15
  puts 'something'
16
16
  end}
17
17
 
18
- describe "Trailing whitespace detection" do
18
+ describe 'Trailing whitespace detection' do
19
19
  before do
20
20
  Tailor::Logger.stub(:log)
21
21
  FakeFS.activate!
@@ -37,28 +37,28 @@ describe "Trailing whitespace detection" do
37
37
  style
38
38
  end
39
39
 
40
- context "line is empty spaces" do
40
+ context 'line is empty spaces' do
41
41
  let(:file_name) { 'empty_line_with_spaces' }
42
42
  specify { critic.problems[file_name].size.should be 1 }
43
- specify { critic.problems[file_name].first[:type].should == "allow_trailing_line_spaces" }
43
+ specify { critic.problems[file_name].first[:type].should == 'allow_trailing_line_spaces' }
44
44
  specify { critic.problems[file_name].first[:line].should be 1 }
45
45
  specify { critic.problems[file_name].first[:column].should be 2 }
46
46
  specify { critic.problems[file_name].first[:level].should be :error }
47
47
  end
48
48
 
49
- context "method contains an empty line with spaces" do
49
+ context 'method contains an empty line with spaces' do
50
50
  let(:file_name) { 'empty_line_with_spaces_in_method' }
51
51
  specify { critic.problems[file_name].size.should be 1 }
52
- specify { critic.problems[file_name].first[:type].should == "allow_trailing_line_spaces" }
52
+ specify { critic.problems[file_name].first[:type].should == 'allow_trailing_line_spaces' }
53
53
  specify { critic.problems[file_name].first[:line].should be 2 }
54
54
  specify { critic.problems[file_name].first[:column].should be 2 }
55
55
  specify { critic.problems[file_name].first[:level].should be :error }
56
56
  end
57
57
 
58
- context "def line ends with spaces" do
58
+ context 'def line ends with spaces' do
59
59
  let(:file_name) { 'trailing_spaces_on_def' }
60
60
  specify { critic.problems[file_name].size.should be 1 }
61
- specify { critic.problems[file_name].first[:type].should == "allow_trailing_line_spaces" }
61
+ specify { critic.problems[file_name].first[:type].should == 'allow_trailing_line_spaces' }
62
62
  specify { critic.problems[file_name].first[:line].should be 1 }
63
63
  specify { critic.problems[file_name].first[:column].should be 11 }
64
64
  specify { critic.problems[file_name].first[:level].should be :error }
@@ -1,9 +1,9 @@
1
- require_relative '../spec_helper'
1
+ require 'spec_helper'
2
2
  require_relative '../support/horizontal_spacing_cases'
3
3
  require 'tailor/critic'
4
4
  require 'tailor/configuration/style'
5
5
 
6
- describe "Horizontal Space problem detection" do
6
+ describe 'Horizontal Space problem detection' do
7
7
  before do
8
8
  Tailor::Logger.stub(:log)
9
9
  FakeFS.activate!
@@ -27,13 +27,13 @@ describe "Horizontal Space problem detection" do
27
27
  File.open(file_name, 'w') { |f| f.write contents }
28
28
  end
29
29
 
30
- it "should be OK" do
30
+ it 'should be OK' do
31
31
  critic.check_file(file_name, style.to_hash)
32
32
  critic.problems.should == { file_name => [] }
33
33
  end
34
34
  end
35
35
 
36
- context "line ends with a backslash" do
36
+ context 'line ends with a backslash' do
37
37
  let(:file_name) { 'line_split_by_backslash' }
38
38
 
39
39
  before do
@@ -41,7 +41,7 @@ describe "Horizontal Space problem detection" do
41
41
  File.open(file_name, 'w') { |f| f.write contents }
42
42
  end
43
43
 
44
- context "no problems" do
44
+ context 'no problems' do
45
45
  let(:contents) do
46
46
  %Q{execute 'myscript' do
47
47
  command \\
@@ -50,13 +50,13 @@ describe "Horizontal Space problem detection" do
50
50
  end}
51
51
  end
52
52
 
53
- it "is OK" do
53
+ it 'is OK' do
54
54
  critic.check_file(file_name, style.to_hash)
55
55
  critic.problems.should == { file_name => [] }
56
56
  end
57
57
  end
58
-
59
- context "line after backslash is too long" do
58
+
59
+ context 'line after backslash is too long' do
60
60
  let(:contents) do
61
61
  %Q{execute 'myscript' do
62
62
  command \\
@@ -65,15 +65,15 @@ end}
65
65
  end}
66
66
  end
67
67
 
68
- it "is OK" do
68
+ it 'is OK' do
69
69
  critic.check_file(file_name, style.to_hash)
70
70
  critic.problems.should == {
71
71
  file_name => [
72
72
  {
73
- :type => "max_line_length",
73
+ :type => 'max_line_length',
74
74
  :line => 3,
75
75
  :column => 81,
76
- :message => "Line is 81 chars long, but should be 80.",
76
+ :message => 'Line is 81 chars long, but should be 80.',
77
77
  :level=>:error
78
78
  }
79
79
  ]