@@ -3,8 +3,8 @@ module TwoFer
33 MESSAGES = {
44 no_module : "No module or class called TwoFer" ,
55 no_method : "No method called two_fer" ,
6- splat_args : "Rather than using *%s, how about acutally setting a paramater called 'name'?" ,
7- missing_default_param : "There is not a correct default param - the tests will fail" ,
6+ splat_args : "Rather than using *%s, how about actually setting a parameter called 'name'?" ,
7+ missing_default_param : "There is no correct default param - the tests will fail" ,
88 incorrect_default_param : "You could set the default value to 'you' to avoid conditionals" ,
99 string_building : "Rather than using string building, use interpolation" ,
1010 kernel_format : "Rather than using the format method, use interpolation" ,
@@ -29,7 +29,7 @@ def analyze!
2929 check_method_signature!
3030
3131 # There is one optimal solution for two-fer which needs
32- # no commnents and can just be approved. If we have it, then
32+ # no comments and can just be approved. If we have it, then
3333 # let's just acknowledge it and get out of here.
3434 check_for_optimal_solution!
3535
@@ -40,14 +40,14 @@ def analyze!
4040 check_for_correct_solution_without_string_interpolaton!
4141
4242 # The most common error in twofer is people using conditionals
43- # to check where the value passed in is nil, rather than using a defaul
43+ # to check where the value passed in is nil, rather than using a default
4444 # value. We want to check for conditionals and tell the user about the
45- # default paramater if we see one.
45+ # default parameter if we see one.
4646 check_for_conditional_on_default_argument!
4747
48- # Sometiems people specify the names (if name == "Alice" ...). If we
48+ # Sometimes people specify the names (if name == "Alice" ...). If we
4949 # do this, suggest using string interpolation to make us of the
50- # paramter , rather than using a conditional on it.
50+ # parameter , rather than using a conditional on it.
5151 # check_for_names!
5252
5353 # We don't have any idea about this solution, so let's refer it to a
@@ -68,7 +68,7 @@ def check_structure!
6868 def check_method_signature!
6969 # If there is no parameter or it doesn't have a default value,
7070 # then this solution won't pass the tests.
71- disapprove! ( :missing_default_param ) if paramaters . size != 1
71+ disapprove! ( :missing_default_param ) if parameters . size != 1
7272
7373 # If they provide a splat, the tests can pass but we
7474 # should suggest they use a real paramater
@@ -101,7 +101,7 @@ def check_for_optimal_solution!
101101 end
102102
103103 def check_for_correct_solution_without_string_interpolaton!
104- # If we don't have a correct default argugment or a one line
104+ # If we don't have a correct default argument or a one line
105105 # solution then let's just get out of here.
106106 return unless default_argument_is_optimal?
107107 return unless one_line_solution?
@@ -133,7 +133,7 @@ def check_for_correct_solution_without_string_interpolaton!
133133 end
134134
135135 # If we have a one-line method that passes the tests, then it's not
136- # soemthing we've planned for, so let's refer it to a mentor
136+ # something we've planned for, so let's refer it to a mentor
137137 return refer_to_mentor!
138138 end
139139
@@ -142,11 +142,11 @@ def check_for_conditional_on_default_argument!
142142
143143 # If we don't have a conditional, then let's get out of here.
144144 #
145- # TODO: We might wnt to refactor this to extract a conditional from the
145+ # TODO: We might want to refactor this to extract a conditional from the
146146 # method rather than insist on it being the first line.
147147 return unless loc . type == :if
148148
149- # Get the clause of the conditional (ie the bit after the "if" keyword)
149+ # Get the clause of the conditional (i.e. the bit after the "if" keyword)
150150 conditional = extract_conditional_clause ( loc )
151151
152152 # Let's warn about using a better default if they `if name == nil`
@@ -155,7 +155,7 @@ def check_for_conditional_on_default_argument!
155155 disapprove! ( :incorrect_default_param )
156156 end
157157
158- # Same thing but if they do it the other way round, ie `if nil == name`
158+ # Same thing but if they do it the other way round, i.e. `if nil == name`
159159 if conditional . receiver == default_argument &&
160160 is_lvar? ( conditional . first_argument , :name )
161161 disapprove! ( :incorrect_default_param )
0 commit comments