Skip to content

Commit 2150d32

Browse files
authored
Merge pull request #5 from katrinleinweber/proof-read
Fix typos & ambiguities
2 parents 331e13a + f1d2d0f commit 2150d32

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is Exercism's automated analyzer for the Ruby track.
44

5-
it is run with `./bin/analyze.sh $EXERCISM $PATH_TO_FILES` and will write a JSON file with an analysis to the same directory.
5+
It is run with `./bin/analyze.sh $EXERCISM $PATH_TO_FILES` and will write a JSON file with an analysis to the same directory.
66

77
For example:
88

lib/analyzers/two_fer/analyze.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

test/exercises/two_fer_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def self.two_fer
9494
}
9595
results = TwoFer::Analyze.(source)
9696
refute results[:approve]
97-
assert_equal ["There is not a correct default param - the tests will fail"], results[:messages]
97+
assert_equal ["There is no correct default param - the tests will fail"], results[:messages]
9898
end
9999

100100
def test_missing_default_value_fails
@@ -108,7 +108,7 @@ def self.two_fer(name)
108108
}
109109
results = TwoFer::Analyze.(source)
110110
refute results[:approve]
111-
assert_equal ["There is not a correct default param - the tests will fail"], results[:messages]
111+
assert_equal ["There is no correct default param - the tests will fail"], results[:messages]
112112
end
113113

114114
def test_splat_fails
@@ -122,7 +122,7 @@ def self.two_fer(*foos)
122122
}
123123
results = TwoFer::Analyze.(source)
124124
refute results[:approve]
125-
assert_equal ["Rather than using *foos, how about acutally setting a paramater called 'name'?"], results[:messages]
125+
assert_equal ["Rather than using *foos, how about actually setting a parameter called 'name'?"], results[:messages]
126126
end
127127

128128
# ### 

0 commit comments

Comments
 (0)