tailor 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. data/History.txt +8 -0
  2. data/Manifest.txt +22 -2
  3. data/PostInstall.txt +4 -0
  4. data/README.rdoc +7 -6
  5. data/Rakefile +7 -1
  6. data/bin/tailor +21 -5
  7. data/features/indentation.feature +22 -0
  8. data/features/spacing.feature +13 -18
  9. data/features/spacing/commas.feature +44 -0
  10. data/features/step_definitions/indentation_steps.rb +139 -0
  11. data/features/step_definitions/spacing/commas_steps.rb +14 -0
  12. data/features/step_definitions/spacing_steps.rb +1 -36
  13. data/features/support/1_file_with_bad_comma_spacing/bad_comma_spacing.rb +43 -5
  14. data/features/support/1_file_with_bad_curly_brace_spacing/bad_curly_brace_spacing.rb +60 -0
  15. data/features/support/1_file_with_bad_operator_spacing/bad_op_spacing.rb +31 -0
  16. data/features/support/1_file_with_bad_parenthesis/bad_parenthesis.rb +1 -3
  17. data/features/support/1_file_with_bad_square_brackets/bad_square_brackets.rb +62 -0
  18. data/features/support/1_file_with_bad_ternary_colon_spacing/bad_ternary_colon_spacing.rb +31 -0
  19. data/features/support/1_good_simple_file/simple_project.rb +5 -0
  20. data/features/support/1_long_file_with_indentation/my_project.rb +56 -0
  21. data/features/support/common.rb +74 -1
  22. data/features/support/env.rb +3 -1
  23. data/features/support/world.rb +0 -52
  24. data/lib/tailor.rb +132 -41
  25. data/lib/tailor/file_line.rb +66 -177
  26. data/lib/tailor/indentation.rb +251 -0
  27. data/lib/tailor/spacing.rb +243 -0
  28. data/lib/tasks/metrics.rake +23 -0
  29. data/lib/tasks/stats.rake +11 -0
  30. data/logic.txt +30 -0
  31. data/ruby-style-checker.rb +77 -46
  32. data/spec/file_line_spec.rb +18 -193
  33. data/spec/indentation_spec.rb +259 -0
  34. data/spec/spacing/colon_spacing_spec.rb +71 -0
  35. data/spec/spacing/comma_spacing_spec.rb +159 -0
  36. data/spec/spacing/curly_brace_spacing_spec.rb +258 -0
  37. data/spec/spacing/parentheses_spacing_spec.rb +28 -0
  38. data/spec/spacing/square_bracket_spacing_spec.rb +116 -0
  39. data/spec/spacing_spec.rb +167 -0
  40. data/spec/spec_helper.rb +4 -0
  41. data/spec/tailor_spec.rb +2 -2
  42. metadata +73 -38
  43. data/features/support/1_good_simple_file/my_project.rb +0 -7
  44. data/lib/tailor/indentation_checker.rb +0 -27
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + "/../../lib/tailor"
1
+ $:.unshift File.dirname(__FILE__) + "/../../lib/tailor"
2
+ require "tailor"
2
3
 
3
4
  gem 'cucumber'
4
5
  require 'cucumber'
@@ -9,6 +10,7 @@ Before do
9
10
  @tmp_root = File.dirname(__FILE__) + "/../../tmp"
10
11
  @home_path = File.expand_path(File.join(@tmp_root, "home"))
11
12
  @lib_path = File.expand_path(File.dirname(__FILE__) + "/../../lib")
13
+ @features_path = File.dirname(__FILE__) + "/../"
12
14
  FileUtils.rm_rf @tmp_root
13
15
  FileUtils.mkdir_p @home_path
14
16
  ENV['HOME'] = @home_path
@@ -1,53 +1 @@
1
- $:.unshift(File.dirname(__FILE__) + '/../../lib')
2
1
 
3
- require 'tailor'
4
-
5
- include Tailor
6
-
7
-
8
- # Counts keywords in the file provided.
9
- #
10
- # @param [String] file Path to the file to check
11
- # @param [String] keyword Keyword to count
12
- # @return [Number] Number of keywords counted
13
- def count_keywords file, keyword
14
- ruby_source = File.open(file, 'r')
15
-
16
- count = 0
17
- ruby_source.each_line do |line|
18
- if line =~ /^#{keyword}/
19
- count =+ 1
20
- end
21
- end
22
- ruby_source.close
23
- count
24
- end
25
-
26
-
27
- # Prep for the testing
28
- Before do
29
- @tailor = "#{File.dirname(__FILE__)}/../../bin/tailor"
30
- end
31
-
32
-
33
- #-----------------------------------------------------------------------------
34
- # "Given" statements
35
- #-----------------------------------------------------------------------------
36
- Given /^I have a project directory "([^\"]*)"$/ do |project_dir|
37
- project_dir = "support/#{project_dir}"
38
- File.exists?(project_dir).should be_true
39
- File.directory?(project_dir).should be_true
40
- @project_dir = project_dir
41
- end
42
-
43
- Given /^the file contains only "([^\"]*)" "([^\"]*)" statement$/ do
44
- |count_in_spec, keyword|
45
- #count_in_file = count_keywords(@ruby_source, keyword)
46
- count_in_file = count_keywords(@file_list[0], keyword)
47
- count_in_file.should == count_in_spec.to_i
48
- end
49
-
50
- Given /^I have "([^\"]*)" file in my project$/ do |file_count|
51
- @file_list = Dir.glob("#{@project_dir}/*")
52
- @file_list.length.should == file_count.to_i
53
- end
@@ -1,24 +1,39 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
2
+ $:.include?(File.dirname(__FILE__)) ||
3
+ $:.include?(File.expand_path(File.dirname(__FILE__)))
3
4
 
4
5
  require 'fileutils'
5
6
  require 'pathname'
6
7
  require 'tailor/file_line'
8
+ require 'tailor/spacing'
7
9
 
8
10
  module Tailor
9
- VERSION = '0.0.3'
10
-
11
- RUBY_KEYWORDS_WITH_END = [
12
- 'begin',
13
- 'case',
14
- 'class',
15
- 'def',
16
- 'do',
17
- 'if',
18
- 'unless',
19
- 'until',
20
- 'while'
21
- ]
11
+ VERSION = '0.1.0'
12
+
13
+ # These operators should always have 1 space around them
14
+ OPERATORS = {
15
+ :arithmetic => ['+', '-', '*', '/', '%', '++', '--', '**'],
16
+ :assignment => ['=', '+=', '-=', '*=', '/=', '%=', '*=', '**=', '|', '&=',
17
+ '&&=', '>>=', '<<=', '||='],
18
+ :comparison => ['==', '===', '!=', '>', '<', '>=', '<=', '<=>', '!', '~'],
19
+ :gem_version => ['~>'],
20
+ :logical => ['&&', '||', 'and', 'or'],
21
+ :regex => ['^', '|', '!~', '=~'],
22
+ :shift => ['<<', '>>'],
23
+ :ternary => ['?', ':']
24
+ }
25
+
26
+ # These operators should never have spaces around them
27
+ NO_SPACE_AROUND_OPERATORS = {
28
+ :range => ['..', '...'],
29
+ :scope_resolution => ['::']
30
+ }
31
+
32
+ # Don't do anything about these ops; they're just here so we know not to do
33
+ # anything with them.
34
+ DO_NOTHING_OPS = {
35
+ :elements => ['[]', '[]=']
36
+ }
22
37
 
23
38
  # Check all files in a directory for style problems.
24
39
  #
@@ -33,7 +48,7 @@ module Tailor
33
48
 
34
49
  # Process each file
35
50
  ruby_files_in_project.each do |file_name|
36
- problems = find_problems file_name
51
+ problems = find_problems_in file_name
37
52
  files_and_problems[file_name] = problems
38
53
  end
39
54
 
@@ -68,7 +83,7 @@ module Tailor
68
83
  #
69
84
  # @param [String] file_name Path to a file to check styling on.
70
85
  # @return [Number] Returns the number of errors on the file.
71
- def self.find_problems file_name
86
+ def self.find_problems_in file_name
72
87
  source = File.open(file_name, 'r')
73
88
  file_path = Pathname.new(file_name)
74
89
 
@@ -80,11 +95,100 @@ module Tailor
80
95
 
81
96
  @problem_count = 0
82
97
  line_number = 1
98
+ =begin
99
+ current_level = 0.0
100
+ next_level = 0.0
101
+ multi_line_next_level = 0.0
102
+ multi_line = false
103
+ =end
104
+
83
105
  source.each_line do |source_line|
84
106
  line = FileLine.new(source_line, file_path, line_number)
85
107
 
86
- # Check for indenting by spaces only
87
- @problem_count += 1 if line.hard_tabbed?
108
+ =begin
109
+ puts "line num: #{line_number}"
110
+ if line.ends_with_comma?
111
+ puts "COMMA"
112
+ end
113
+ if line.ends_with_backslash?
114
+ puts "BACKSLASH"
115
+ end
116
+ if line.ends_with_operator?
117
+ puts "OPERATOR"
118
+ end
119
+ if line.unclosed_parenthesis?
120
+ puts "PARENTHESIS"
121
+ end
122
+
123
+ multi_line_statement = line.multi_line_statement?
124
+
125
+ # If we're not in a multi-line statement, but this is the beginning of
126
+ # one...
127
+ if multi_line == false and multi_line_statement
128
+ multi_line = true
129
+ multi_line_next_level = current_level + 1.0
130
+ puts ":multi-line: current = #{current_level}; next = #{next_level}" +
131
+ "; multi_line_next = #{multi_line_next_level}"
132
+ # If we're already in a multi-line statement...
133
+ elsif multi_line == true and multi_line_statement
134
+ puts ":multi-line: current = #{current_level}; next = #{next_level}" +
135
+ "; multi_line_next = #{multi_line_next_level}"
136
+ # Keep current_line and next_line the same
137
+ elsif multi_line == true and !multi_line_statement and line.indent?
138
+ #next_level -= 1.0
139
+ puts ":multi-line: current = #{current_level}; next = #{next_level}" +
140
+ "; multi_line_next = #{multi_line_next_level}"
141
+ else
142
+ multi_line = false
143
+ end
144
+
145
+ if line.outdent?
146
+ current_level -= 1.0
147
+ next_level = current_level + 1.0
148
+ puts ":outdent: current = #{current_level}; next = #{next_level}" +
149
+ "; multi_line_next = #{multi_line_next_level}"
150
+ end
151
+
152
+ if line.contains_end?
153
+ current_level -= 1.0
154
+ next_level = current_level
155
+ puts ":end: current = #{current_level}; next = #{next_level}" +
156
+ "; multi_line_next = #{multi_line_next_level}"
157
+ end
158
+
159
+ if multi_line == true and !multi_line_statement and line.indent?
160
+ elsif line.indent?
161
+ next_level = current_level + 1.0
162
+ puts ":indent: current = #{current_level}; next = #{next_level}" +
163
+ "; multi_line_next = #{multi_line_next_level}"
164
+ end
165
+
166
+ if !line.indent? and !line.outdent? and !line.contains_end?
167
+ puts ":same: current = #{current_level}; next = #{next_level}" +
168
+ "; multi_line_next = #{multi_line_next_level}"
169
+ end
170
+
171
+ #if line.indent? or line.outdent? or line.contains_end?
172
+ if line.at_improper_level? current_level
173
+ @problem_count += 1
174
+ end
175
+ #end
176
+
177
+ # If this is the last line of the multi-line statement...
178
+ if multi_line == true and multi_line_statement
179
+ puts "Assinging current (#{current_level}) to multi_next (#{multi_line_next_level})"
180
+ current_level = multi_line_next_level
181
+ elsif multi_line == true and !multi_line_statement
182
+ multi_line = false
183
+ puts "Assigning current (#{current_level}) = next (#{next_level}) "
184
+ current_level = next_level
185
+ #elsif multi_line == false
186
+ else
187
+ puts "Assigning current (#{current_level}) = next (#{next_level}) "
188
+ current_level = next_level
189
+ end
190
+ =end
191
+ @problem_count += line.spacing_problems
88
192
 
89
193
  # Check for camel-cased methods
90
194
  @problem_count += 1 if line.method_line? and line.camel_case_method?
@@ -92,32 +196,18 @@ module Tailor
92
196
  # Check for non-camel-cased classes
93
197
  @problem_count += 1 if line.class_line? and line.snake_case_class?
94
198
 
95
- # Check for trailing whitespace
96
- @problem_count += 1 if line.trailing_whitespace?
97
-
98
199
  # Check for long lines
99
200
  @problem_count += 1 if line.too_long?
100
201
 
101
- # Check for spacing after commas
102
- @problem_count += 1 if line.more_than_one_space_after_comma?
103
-
104
- # Check for spacing after commas
105
- @problem_count += 1 if line.no_space_after_comma?
106
-
107
- # Check for spacing after commas
108
- @problem_count += 1 if line.space_before_comma?
109
-
110
- # Check for spacing after open parentheses
111
- @problem_count += 1 if line.space_after_open_parenthesis?
112
-
113
- # Check for spacing after open brackets
114
- @problem_count += 1 if line.space_after_open_bracket?
115
-
116
- # Check for spacing after closed parentheses
117
- @problem_count += 1 if line.space_before_closed_parenthesis?
118
-
119
- # Check for spacing after closed brackets
120
- @problem_count += 1 if line.space_before_closed_bracket?
202
+ # Check for spacing around operators
203
+ =begin
204
+ OPERATORS.each_pair do |op_group, op_values|
205
+ op_values.each do |op|
206
+ @problem_count += 1 if line.no_space_before? op
207
+ @problem_count += 1 if line.no_space_after? op
208
+ end
209
+ end
210
+ =end
121
211
 
122
212
  line_number += 1
123
213
  end
@@ -125,6 +215,7 @@ module Tailor
125
215
  @problem_count
126
216
  end
127
217
 
218
+ ##
128
219
  # Prints a summary report that shows which files had how many problems.
129
220
  #
130
221
  # @param [Hash] files_and_problems Returns a hash that contains
@@ -1,4 +1,7 @@
1
- require 'pathname'
1
+ require 'tailor/spacing'
2
+ require 'tailor/indentation'
3
+ require 'logger'
4
+ require 'term/ansicolor'
2
5
 
3
6
  module Tailor
4
7
 
@@ -10,6 +13,9 @@ module Tailor
10
13
  # true and print the associated error message when the bad style condition
11
14
  # is discovered in the file line.
12
15
  class FileLine < String
16
+ include Tailor::Spacing
17
+ include Tailor::Indentation
18
+ include Term::ANSIColor
13
19
 
14
20
  LINE_LENGTH_MAX = 80
15
21
 
@@ -27,33 +33,10 @@ module Tailor
27
33
  super line_of_code
28
34
  @file_path = file_path
29
35
  @line_number = line_number
30
- end
31
-
32
- # Determines the number of spaces the line is indented.
33
- #
34
- # @return [Number] Returns the number of spaces the line is indented.
35
- def indented_spaces
36
- # Find out how many spaces exist at the beginning of the line
37
- spaces = self.scan(/^\x20+/).first
38
-
39
- unless spaces.nil?
40
- return spaces.length
41
- else
42
- return 0
43
- end
44
- end
45
-
46
- # Checks to see if the source code line contains any hard tabs.
47
- #
48
- # @return [Boolean] Returns true if the file line contains hard tabs.
49
- # false if the line contains only spaces.
50
- def hard_tabbed?
51
- if self.scan(/\t/).empty?
52
- return false
53
- else
54
- print_problem "Line contains hard tabs:"
55
- return true
56
- end
36
+ @line_problem_count = 0
37
+ @logger = ::Logger.new(STDOUT)
38
+ #@logger.datetime_format = "%H:%M:%S"
39
+ @logger.datetime_format = ""
57
40
  end
58
41
 
59
42
  # Checks to see if the method name is using camel case.
@@ -70,11 +53,12 @@ module Tailor
70
53
 
71
54
  # The 2nd word is the method name, so evaluate that for caps chars.
72
55
  if words[1] =~ /[A-Z]/
73
- print_problem "Method name uses camel case:"
56
+ @line_problem_count += 1
57
+ print_problem "Method name uses camel case"
74
58
  return true
75
- else
76
- return false
77
59
  end
60
+
61
+ return false
78
62
  end
79
63
 
80
64
  # Checks to see if the class name is using snake case.
@@ -91,23 +75,38 @@ module Tailor
91
75
 
92
76
  # The 2nd word is the class name, so check that.
93
77
  if words[1] =~ /_/
94
- print_problem "Class name does NOT use camel case:"
78
+ @line_problem_count += 1
79
+ print_problem "Class name does NOT use camel case"
95
80
  return true
96
- else
97
- return false
98
81
  end
82
+
83
+ return false
99
84
  end
100
85
 
101
86
  # Checks to see if the line is the start of a method's definition.
102
87
  #
103
88
  # @return [Boolean] Returns true if the line starts with 'def'.
104
89
  def method_line?
105
- words = self.split(/ /)
90
+ words = self.strip.split(/ /)
106
91
  if words[0].eql? "def"
107
92
  return true
108
- else
109
- return false
110
93
  end
94
+
95
+ return false
96
+ end
97
+
98
+ ##
99
+ # Returns the name of the method if the line is one that contains a method
100
+ # definition.
101
+ #
102
+ # @return [String] The method name.
103
+ def method_name
104
+ unless self.method_line?
105
+ return nil
106
+ end
107
+
108
+ words = self.strip.split(/ /)
109
+ words[1]
111
110
  end
112
111
 
113
112
  # Checks to see if the line is the start of a class's definition.
@@ -118,9 +117,9 @@ module Tailor
118
117
  words = self.split(/ /)
119
118
  if words[0].eql? "class" and starts_with_uppercase?(words[1])
120
119
  return true
121
- else
122
- return false
123
120
  end
121
+
122
+ return false
124
123
  end
125
124
 
126
125
  ##
@@ -132,9 +131,9 @@ module Tailor
132
131
  def statement_line?
133
132
  if self.method_line? or self.class_line? or self.comment_line?
134
133
  return false
135
- else
136
- return true
137
134
  end
135
+
136
+ return true
138
137
  end
139
138
 
140
139
  # Checks to see if the whole line is a basic comment line. This doesn't
@@ -142,142 +141,23 @@ module Tailor
142
141
  #
143
142
  # @return [Boolean] Returns true if the line begins with a pound symbol.
144
143
  def comment_line?
145
- if self.scan(/\s*#/).empty?
146
- return false
147
- else
148
- return true
149
- end
150
- end
151
-
152
- ##
153
- # Checks to see if there's whitespace at the end of the line. Prints the
154
- # number of whitespaces at the end of the line.
155
- #
156
- # @return [Boolean] Returns true if theres whitespace at the end of the
157
- # line.
158
- def trailing_whitespace?
159
- count = self.trailing_whitespace_count
160
-
161
- if count > 0
162
- print_problem "Line contains #{count} trailing whitespace(s):"
163
- return true
164
- else
165
- return false
166
- end
167
- end
168
-
169
- # Checks to see if the line has trailing whitespace at the end of it. Note
170
- # that this excludes empty lines that have spaces on them!
171
- #
172
- # @return [Number] Returns the number of trailing spaces at the end of the
173
- # line.
174
- def trailing_whitespace_count
175
- spaces = self.scan(/(\x20+|\x09+)$/)
176
- if spaces.first.eql? nil
177
- return 0
178
- else
179
- return spaces.first.first.length
180
- end
181
- end
182
-
183
- ##
184
- # Checks to see if there's more than one one space after a comma.
185
- #
186
- # @return [Boolean] Returns true if there is more than one space after
187
- # a comma.
188
- def more_than_one_space_after_comma?
189
- if self.scan(/\,\x20{2,}/).first.nil?
190
- return false
191
- elsif self.scan(/\,\x20{2,}/)
192
- print_problem "Line has a comma with > 1 space after it:"
144
+ unless self.scan(/^\s*#/).empty?
193
145
  return true
194
146
  end
195
- end
196
147
 
197
- ##
198
- # Checks to see if there's no spaces after a comma and the next word.
199
- #
200
- # @return [Boolean] Returns true if there's no spaces between a comma and
201
- # the next word.
202
- def no_space_after_comma?
203
- if self.scan(/\w\x20?\,\w/).first.nil?
204
- return false
205
- elsif self.scan(/\w\x20?\,\w/)
206
- print_problem "Line has a comma with 0 spaces after it:"
207
- return true
208
- end
148
+ return false
209
149
  end
210
150
 
211
151
  ##
212
- # Checks to see if there's spaces before a comma.
152
+ # Checks to see if the whole line is only space characters.
213
153
  #
214
- # @return [Boolean] Returns true if there's any spaces before a comma.
215
- # Returns nil if the line doesn't contain a comma.
216
- def space_before_comma?
217
- if self.scan(/\w\x20+\,/).first.nil?
154
+ # @return [Boolean] Returns true if the line is only space characters.
155
+ def empty_line?
156
+ if self.scan(/^\s*$/).empty?
218
157
  return false
219
- elsif self.scan(/\w\x20+\,/)
220
- print_problem "Line has at least one space before a comma:"
221
- return true
222
- else
223
- return nil
224
158
  end
225
- end
226
159
 
227
- ##
228
- # Checks to see if there's spaces after an open parenthesis.
229
- #
230
- # @return [Boolean] Returns true if there's spaces after an open
231
- # parenthesis.
232
- def space_after_open_parenthesis?
233
- if self.scan(/\(\x20+/).first.nil?
234
- return false
235
- elsif self.scan(/\(\x20+/)
236
- print_problem "Line has an open parenthesis with spaces after it:"
237
- return true
238
- end
239
- end
240
-
241
- ##
242
- # Checks to see if there's spaces after an open bracket.
243
- #
244
- # @return [Boolean] Returns true if there's spaces after an open
245
- # bracket.
246
- def space_after_open_bracket?
247
- if self.scan(/\[\x20+/).first.nil?
248
- return false
249
- elsif self.scan(/\[\x20+/)
250
- print_problem "Line has an open bracket with spaces after it:"
251
- return true
252
- end
253
- end
254
-
255
- ##
256
- # Checks to see if there's spaces before a closed parenthesis.
257
- #
258
- # @return [Boolean] Returns true if there's spaces before a closed
259
- # parenthesis.
260
- def space_before_closed_parenthesis?
261
- if self.scan(/\x20+\)/).first.nil?
262
- return false
263
- elsif self.scan(/\x20+\)/)
264
- print_problem "Line has a closed parenthesis with spaces before it:"
265
- return true
266
- end
267
- end
268
-
269
- ##
270
- # Checks to see if there's spaces before a closed brackets.
271
- #
272
- # @return [Boolean] Returns true if there's spaces before a closed
273
- # bracket.
274
- def space_before_closed_bracket?
275
- if self.scan(/\x20+\]/).first.nil?
276
- return false
277
- elsif self.scan(/\x20+\]/)
278
- print_problem "Line has a closed bracket with spaces before it:"
279
- return true
280
- end
160
+ return true
281
161
  end
282
162
 
283
163
  ##
@@ -287,12 +167,14 @@ module Tailor
287
167
  # @return [Boolean] Returns true if the line length exceeds the allowed
288
168
  # length.
289
169
  def too_long?
290
- if self.length > LINE_LENGTH_MAX
291
- print_problem "Line is greater than #{LINE_LENGTH_MAX} characters:"
170
+ length = self.length
171
+ if length > LINE_LENGTH_MAX
172
+ @line_problem_count += 1
173
+ print_problem "Line is >#{LINE_LENGTH_MAX} characters (#{length})"
292
174
  return true
293
- else
294
- return false
295
175
  end
176
+
177
+ return false
296
178
  end
297
179
 
298
180
  #-----------------------------------------------------------------
@@ -305,8 +187,15 @@ module Tailor
305
187
  #
306
188
  # @param [String] Error message to print.
307
189
  def print_problem message
308
- puts message
309
- puts "\t#{@file_path.relative_path_from(Pathname.pwd)}: #{@line_number}"
190
+ if @line_problem_count == 1
191
+ line_info = "Problems in"
192
+ line_info += " #{@file_path.relative_path_from(Pathname.pwd)}"
193
+ line_info += " [#{@line_number}]:"
194
+
195
+ puts ""
196
+ puts line_info
197
+ end
198
+ puts red("\t"+ message)
310
199
  end
311
200
 
312
201
  # Checks to see if a word begins with a lowercase letter.
@@ -315,9 +204,9 @@ module Tailor
315
204
  def starts_with_lowercase? word
316
205
  if word =~ /^[a-z]/
317
206
  return true
318
- else
319
- return false
320
207
  end
208
+
209
+ return false
321
210
  end
322
211
 
323
212
  # Checks to see if a word begins with an uppercase letter.
@@ -326,9 +215,9 @@ module Tailor
326
215
  def starts_with_uppercase? word
327
216
  if word =~ /^[A-Z]/
328
217
  return true
329
- else
330
- return false
331
218
  end
219
+
220
+ return false
332
221
  end
333
222
  end
334
223
  end