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
@@ -2,6 +2,7 @@ require_relative '../../ruler'
2
2
  require_relative '../../logger'
3
3
  require_relative '../../lexer/lexer_constants'
4
4
 
5
+
5
6
  class Tailor
6
7
  module Rulers
7
8
  class IndentationSpacesRuler < Tailor::Ruler
@@ -74,7 +75,7 @@ class Tailor
74
75
  log "@proper[:this_line] = #{@proper[:this_line]}"
75
76
  log "@proper[:next_line] = #{@proper[:next_line]}"
76
77
  else
77
- log "#decrease_this_line called, but checking is stopped."
78
+ log '#decrease_this_line called, but checking is stopped.'
78
79
  end
79
80
  end
80
81
 
@@ -90,20 +91,20 @@ class Tailor
90
91
  # +@proper[:this_line]+.
91
92
  def transition_lines
92
93
  if started?
93
- log "Resetting change_this to 0."
94
+ log 'Resetting change_this to 0.'
94
95
  @amount_to_change_this = 0
95
- log "Setting @proper[:this_line] = that of :next_line"
96
+ log 'Setting @proper[:this_line] = that of :next_line'
96
97
  @proper[:this_line] = @proper[:next_line]
97
98
  log "Transitioning @proper[:this_line] to #{@proper[:this_line]}"
98
99
  else
99
- log "Skipping #transition_lines; checking is stopped."
100
+ log 'Skipping #transition_lines; checking is stopped.'
100
101
  end
101
102
  end
102
103
 
103
104
  # Starts the process of increasing/decreasing line indentation
104
105
  # expectations.
105
106
  def start
106
- log "Starting indentation ruling."
107
+ log 'Starting indentation ruling.'
107
108
  log "Next check should be at #{should_be_at}"
108
109
  @do_measurement = true
109
110
  end
@@ -132,7 +133,7 @@ class Tailor
132
133
  # @param [Array] lexed_line_output The lexed output for the current line.
133
134
  def update_actual_indentation(lexed_line_output)
134
135
  if lexed_line_output.end_of_multi_line_string?
135
- log "Found end of multi-line string."
136
+ log 'Found end of multi-line string.'
136
137
  return
137
138
  end
138
139
 
@@ -237,7 +238,7 @@ class Tailor
237
238
  # not an opening or closing reason, such as +elsif+, +rescue+, +when+
238
239
  # (in a +case+ statement), etc.
239
240
  #
240
- # @param [Symbol] event_type The event type that is the opening reason.
241
+ # @param [Symbol] token
241
242
  # @param [Tailor::LexedLine] lexed_line
242
243
  # @param [Fixnum] lineno The line number the opening reason was found
243
244
  # on.
@@ -285,11 +286,11 @@ class Tailor
285
286
 
286
287
  log "Updated :next after closing; it's now #{@proper[:next_line]}"
287
288
 
288
- meth = "only_#{event_type.to_s.sub("^on_", '')}?"
289
+ meth = "only_#{event_type.to_s.sub('^on_', '')}?"
289
290
 
290
291
  if lexed_line.send(meth.to_sym) || lexed_line.to_s =~ /^\s*end\n?$/
291
292
  @proper[:this_line] = @proper[:this_line] - @spaces
292
- msg = "End multi-line statement. "
293
+ msg = 'End multi-line statement. '
293
294
  msg < "change_this -= 1 -> #{@proper[:this_line]}."
294
295
  log msg
295
296
  end
@@ -337,7 +338,6 @@ class Tailor
337
338
  end
338
339
  end
339
340
 
340
-
341
341
  # Returns the last matching opening event that corresponds to the
342
342
  # +closing_event_type+.
343
343
  #
@@ -375,9 +375,9 @@ class Tailor
375
375
  def method_missing(meth, *args, &blk)
376
376
  if meth.to_s =~ /^multi_line_(.+)\?$/
377
377
  token = case $1
378
- when "brackets" then '['
379
- when "braces" then '{'
380
- when "parens" then '('
378
+ when 'brackets' then '['
379
+ when 'braces' then '{'
380
+ when 'parens' then '('
381
381
  else
382
382
  super(meth, *args, &blk)
383
383
  end
@@ -34,7 +34,7 @@ class Tailor
34
34
  end
35
35
 
36
36
  def kw_update(token, lexed_line, lineno, column)
37
- if token == "class" || token == "module"
37
+ if token == 'class' || token == 'module'
38
38
  @class_start_lines << { lineno: lineno, column: column, count: 0 }
39
39
  log "Class start lines: #{@class_start_lines}"
40
40
  end
@@ -47,7 +47,7 @@ class Tailor
47
47
  log "Keyword start lines: #{@kw_start_lines}"
48
48
  end
49
49
 
50
- if token == "end"
50
+ if token == 'end'
51
51
  log "Got 'end' of class/module."
52
52
 
53
53
  unless @class_start_lines.empty?
@@ -34,7 +34,7 @@ class Tailor
34
34
  end
35
35
 
36
36
  def kw_update(token, lexed_line, lineno, column)
37
- if token == "def"
37
+ if token == 'def'
38
38
  @method_start_lines << { lineno: lineno, column: column, count: 0 }
39
39
  log "Method start lines: #{@method_start_lines}"
40
40
  end
@@ -47,7 +47,7 @@ class Tailor
47
47
  log "Keyword start lines: #{@kw_start_lines}"
48
48
  end
49
49
 
50
- if token == "end"
50
+ if token == 'end'
51
51
  log "Got 'end' of method."
52
52
 
53
53
  unless @method_start_lines.empty?
@@ -20,7 +20,7 @@ class Tailor
20
20
 
21
21
  def comment_update(token, lexed_line, file_text, lineno, column)
22
22
  if token =~ /\n$/
23
- log "Found comment with trailing newline."
23
+ log 'Found comment with trailing newline.'
24
24
  ignored_nl_update(lexed_line, lineno, column)
25
25
  end
26
26
  end
@@ -55,29 +55,29 @@ class Tailor
55
55
  @comma_columns.each do |c|
56
56
  event_index = lexed_line.event_index(c)
57
57
  if event_index.nil?
58
- log "Event index is nil. Weird..."
58
+ log 'Event index is nil. Weird...'
59
59
  break
60
60
  end
61
61
 
62
62
  next_event = lexed_line.at(event_index + 1)
63
63
  if next_event.nil?
64
- log "Looks like there is no next event (this is last in the line)."
64
+ log 'Looks like there is no next event (this is last in the line).'
65
65
  break
66
66
  end
67
67
 
68
68
  if next_event[1] == :on_nl || next_event[1] == :on_ignored_nl
69
- log "Next event is a newline."
69
+ log 'Next event is a newline.'
70
70
  break
71
71
  end
72
72
 
73
73
  second_next_event = lexed_line.at(event_index + 2)
74
74
  if second_next_event.nil?
75
- log "Second next event is nil."
75
+ log 'Second next event is nil.'
76
76
  next
77
77
  end
78
78
 
79
79
  if second_next_event[1] == :on_comment
80
- log "Event + 2 is a comment."
80
+ log 'Event + 2 is a comment.'
81
81
  next
82
82
  end
83
83
 
@@ -0,0 +1,48 @@
1
+ require_relative '../ruler'
2
+
3
+ class Tailor
4
+ module Rulers
5
+ class SpacesAfterConditionalRuler < Tailor::Ruler
6
+
7
+ def initialize(config, options)
8
+ super(config, options)
9
+ add_lexer_observers :nl
10
+ end
11
+
12
+ def nl_update(current_lexed_line, lineno, column)
13
+ measure(current_lexed_line, lineno)
14
+ end
15
+
16
+ # Checks to see if spacing is present after conditionals
17
+ #
18
+ # @param [Array] lexed_line The lexed line with a conditional
19
+ # @param [Fixnum] lineno Line the problem was found on.
20
+ def measure(lexed_line, lineno)
21
+
22
+ idx = lexed_line.index do |pos, token, name|
23
+ token == :on_kw and %w{if unless case}.include?(name)
24
+ end
25
+
26
+ expected_spaces = @config
27
+ spaces = expected_spaces
28
+
29
+ if idx
30
+ column = lexed_line[idx].first.last
31
+ pos, token, name = lexed_line[idx + 1]
32
+ spaces = case token
33
+ when :on_lparen then 0
34
+ when :on_sp
35
+ next_token = lexed_line[idx + 2]
36
+ next_token.first.last - pos.last
37
+ end
38
+ end
39
+
40
+ if expected_spaces != spaces
41
+ @problems << Problem.new(problem_type, lineno, column,
42
+ "#{spaces} spaces after conditional at column #{column}, " +
43
+ "expected #{expected_spaces}.", @options[:level])
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -3,7 +3,7 @@ require_relative '../ruler'
3
3
  class Tailor
4
4
  module Rulers
5
5
 
6
- # Checks for spaces after a '{' as given by +@config+. It skips checking
6
+ # Checks for spaces after a +{+ as given by +@config+. It skips checking
7
7
  # when:
8
8
  # * it's at the end of a line.
9
9
  # * the next char is a '}'
@@ -17,7 +17,7 @@ class Tailor
17
17
 
18
18
  def comment_update(token, lexed_line, file_text, lineno, column)
19
19
  if token =~ /\n$/
20
- log "Found comment with trailing newline."
20
+ log 'Found comment with trailing newline.'
21
21
  ignored_nl_update(lexed_line, lineno, column)
22
22
  end
23
23
  end
@@ -57,8 +57,8 @@ class Tailor
57
57
  actual_spaces = count_spaces(lexed_line, column)
58
58
  next if actual_spaces.nil?
59
59
 
60
- if @do_measurement == false
61
- log "Skipping measurement."
60
+ if !@do_measurement
61
+ log 'Skipping measurement.'
62
62
  else
63
63
  measure(actual_spaces, lineno, column)
64
64
  end
@@ -79,7 +79,7 @@ class Tailor
79
79
  event_index = lexed_line.event_index(column)
80
80
 
81
81
  if event_index.nil?
82
- log "No lbrace in this line. Moving on..."
82
+ log 'No lbrace in this line. Moving on...'
83
83
  @do_measurement = false
84
84
  return
85
85
  end
@@ -87,7 +87,7 @@ class Tailor
87
87
  next_event = lexed_line.at(event_index + 1)
88
88
 
89
89
  if next_event.nil?
90
- log "lbrace must be at the end of the line. Moving on."
90
+ log 'lbrace must be at the end of the line. Moving on.'
91
91
  @do_measurement = false
92
92
  return 0
93
93
  end
@@ -99,14 +99,14 @@ class Tailor
99
99
  end
100
100
 
101
101
  if next_event[1] == :on_rbrace
102
- log "lbrace is followed by an rbrace. Moving on."
102
+ log 'lbrace is followed by an rbrace. Moving on.'
103
103
  @do_measurement = false
104
104
  return 0
105
105
  end
106
106
 
107
107
  second_next_event = lexed_line.at(event_index + 2)
108
108
  if second_next_event[1] == :on_comment
109
- log "Event + 2 is a comment."
109
+ log 'Event + 2 is a comment.'
110
110
  @do_measurement = false
111
111
  return next_event.last.size
112
112
  end
@@ -17,7 +17,7 @@ class Tailor
17
17
 
18
18
  def comment_update(token, lexed_line, file_text, lineno, column)
19
19
  if token =~ /\n$/
20
- log "Found comment with trailing newline."
20
+ log 'Found comment with trailing newline.'
21
21
  ignored_nl_update(lexed_line, lineno, column)
22
22
  end
23
23
  end
@@ -59,8 +59,8 @@ class Tailor
59
59
  actual_spaces = count_spaces(lexed_line, column)
60
60
  next if actual_spaces.nil?
61
61
 
62
- if @do_measurement == false
63
- log "Skipping measurement."
62
+ if !@do_measurement
63
+ log 'Skipping measurement.'
64
64
  else
65
65
  measure(actual_spaces, lineno, column)
66
66
  end
@@ -81,7 +81,7 @@ class Tailor
81
81
  event_index = lexed_line.event_index(column)
82
82
 
83
83
  if event_index.nil?
84
- log "No lbracket in this line. Moving on..."
84
+ log 'No lbracket in this line. Moving on...'
85
85
  @do_measurement = false
86
86
  return
87
87
  end
@@ -90,7 +90,7 @@ class Tailor
90
90
  log "Next event: #{next_event}"
91
91
 
92
92
  if next_event.nil?
93
- log "lbracket must be at the end of the line."
93
+ log 'lbracket must be at the end of the line.'
94
94
  @do_measurement = false
95
95
  return 0
96
96
  end
@@ -104,7 +104,7 @@ class Tailor
104
104
  end
105
105
 
106
106
  if next_event[1] == :on_rbracket
107
- log "lbracket is followed by a rbracket. Moving on."
107
+ log 'lbracket is followed by a rbracket. Moving on.'
108
108
  @do_measurement = false
109
109
  return 0
110
110
  end
@@ -11,7 +11,7 @@ class Tailor
11
11
 
12
12
  def comment_update(token, lexed_line, file_text, lineno, column)
13
13
  if token =~ /\n$/
14
- log "Found comment with trailing newline."
14
+ log 'Found comment with trailing newline.'
15
15
  ignored_nl_update(lexed_line, lineno, column)
16
16
  end
17
17
  end
@@ -53,8 +53,8 @@ class Tailor
53
53
  actual_spaces = count_spaces(lexed_line, column)
54
54
  next if actual_spaces.nil?
55
55
 
56
- if @do_measurement == false
57
- log "Skipping measurement."
56
+ if !@do_measurement
57
+ log 'Skipping measurement.'
58
58
  else
59
59
  measure(actual_spaces, lineno, column)
60
60
  end
@@ -75,7 +75,7 @@ class Tailor
75
75
  event_index = lexed_line.event_index(column)
76
76
 
77
77
  if event_index.nil?
78
- log "No lparen in this line. Moving on..."
78
+ log 'No lparen in this line. Moving on...'
79
79
  @do_measurement = false
80
80
  return
81
81
  end
@@ -84,7 +84,7 @@ class Tailor
84
84
  log "Next event: #{next_event}"
85
85
 
86
86
  if next_event.nil?
87
- log "lparen must be at the end of the line."
87
+ log 'lparen must be at the end of the line.'
88
88
  @do_measurement = false
89
89
  return 0
90
90
  end
@@ -97,7 +97,7 @@ class Tailor
97
97
  end
98
98
 
99
99
  if next_event[1] == :on_rparen
100
- log "lparen is followed by an rparen. Moving on."
100
+ log 'lparen is followed by an rparen. Moving on.'
101
101
  @do_measurement = false
102
102
  return 0
103
103
  end
@@ -17,7 +17,7 @@ class Tailor
17
17
 
18
18
  def comment_update(token, lexed_line, file_text, lineno, column)
19
19
  if token =~ /\n$/
20
- log "Found comment with trailing newline."
20
+ log 'Found comment with trailing newline.'
21
21
  ignored_nl_update(lexed_line, lineno, column)
22
22
  end
23
23
  end
@@ -42,7 +42,7 @@ class Tailor
42
42
  @comma_columns.each do |c|
43
43
  event_index = lexed_line.event_index(c)
44
44
  if event_index.nil?
45
- log "Event index is nil. Weird..."
45
+ log 'Event index is nil. Weird...'
46
46
  next
47
47
  end
48
48
 
@@ -28,7 +28,7 @@ class Tailor
28
28
  log "Previous event: #{previous_event}"
29
29
 
30
30
  if column.zero? || previous_event.nil?
31
- log "lbrace must be at the beginning of the line."
31
+ log 'lbrace must be at the beginning of the line.'
32
32
  @do_measurement = false
33
33
  return 0
34
34
  end
@@ -54,7 +54,7 @@ class Tailor
54
54
  return 0 if previous_event[1] != :on_sp
55
55
 
56
56
  if current_index - 2 < 0
57
- log "lbrace comes at the beginning of an indented line."
57
+ log 'lbrace comes at the beginning of an indented line.'
58
58
  @do_measurement = false
59
59
  return previous_event.last.size
60
60
  end
@@ -71,8 +71,8 @@ class Tailor
71
71
  count = count_spaces(lexed_line, column)
72
72
  log "Found #{count} space(s) before lbrace."
73
73
 
74
- if @do_measurement == false
75
- log "Skipping measurement."
74
+ if !@do_measurement
75
+ log 'Skipping measurement.'
76
76
  else
77
77
  measure(count, lineno, column)
78
78
  end
@@ -7,7 +7,7 @@ class Tailor
7
7
  # when:
8
8
  # * it's the first char in the line.
9
9
  # * it's the first char in the line, preceded by spaces.
10
- # * it's directly preceded by a '{'.
10
+ # * it's directly preceded by a +{+.
11
11
  class SpacesBeforeRbraceRuler < Tailor::Ruler
12
12
  def initialize(config, options)
13
13
  super(config, options)
@@ -18,7 +18,7 @@ class Tailor
18
18
 
19
19
  # @param [LexedLine] lexed_line
20
20
  # @param [Fixnum] column
21
- # @return [Fixnum] The number of spaces before the rbrace.
21
+ # @return [Fixnum] the number of spaces before the rbrace.
22
22
  def count_spaces(lexed_line, column)
23
23
  current_index = lexed_line.event_index(column)
24
24
  log "Current event index: #{current_index}"
@@ -26,7 +26,7 @@ class Tailor
26
26
  log "Previous event: #{previous_event}"
27
27
 
28
28
  if column.zero? || previous_event.nil?
29
- log "rbrace is at the beginning of the line."
29
+ log 'rbrace is at the beginning of the line.'
30
30
  @do_measurement = false
31
31
  return 0
32
32
  end
@@ -40,7 +40,7 @@ class Tailor
40
40
  return 0 if previous_event[1] != :on_sp
41
41
 
42
42
  if current_index - 2 < 0
43
- log "rbrace is at the beginning of an indented line. Moving on."
43
+ log 'rbrace is at the beginning of an indented line. Moving on.'
44
44
  @do_measurement = false
45
45
  return previous_event.last.size
46
46
  end
@@ -74,9 +74,9 @@ class Tailor
74
74
  end
75
75
  end
76
76
 
77
- # For Ruby versions < 2.0.0-p0, this has to keep track of '{'s and only
78
- # follow through with the check if the '{' was an lbrace because Ripper
79
- # doesn't scan the '}' of an embedded expression (embexpr_end) as such.
77
+ # For Ruby versions < 2.0.0-p0, this has to keep track of +{+'s and only
78
+ # follow through with the check if the +{+ was an lbrace because Ripper
79
+ # doesn't scan the +}+ of an embedded expression (embexpr_end) as such.
80
80
  #
81
81
  # @param [Tailor::LexedLine] lexed_line
82
82
  # @param [Fixnum] lineno
@@ -92,8 +92,8 @@ class Tailor
92
92
  count = count_spaces(lexed_line, column)
93
93
  log "Found #{count} space(s) before rbrace."
94
94
 
95
- if @do_measurement == false
96
- log "Skipping measurement."
95
+ if !@do_measurement
96
+ log 'Skipping measurement.'
97
97
  else
98
98
  measure(count, lineno, column)
99
99
  end