Skip to content

Commit f51b21e

Browse files
committed
String 'concatenation' instead of 'building'
1 parent 4a39f3a commit f51b21e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/analyzers/two_fer/analyze.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module TwoFer
99
missing_default_param: "ruby.two-fer.missing_default_param", # "There is no correct default param - the tests will fail"
1010
incorrect_default_param: "ruby.two-fer.incorrect_default_param", # "You could set the default value to 'you' to avoid conditionals"
1111
reassigning_param: "ruby.two-fer.reassigning_param", # "You don't need to reassign - use the default param"
12-
string_building: "ruby.two-fer.avoid_string_building", # "Rather than using string building, use interpolation"
12+
string_concatenation: "ruby.two-fer.avoid_string_concatenation", # "Rather than using string building, use interpolation"
1313
kernel_format: "ruby.two-fer.avoid_kernel_format", # "Rather than using the format method, use interpolation"
1414
string_format: "ruby.two-fer.avoid_string_format", # "Rather than using string's format/percentage method, use interpolation"
1515
}
@@ -84,7 +84,7 @@ def check_for_single_line_solution!
8484
end
8585

8686
# "One for " + name + ", one for me."
87-
approve_if_implicit_return!(:string_building, {name_variable: solution.first_parameter_name}) if solution.uses_string_building?
87+
approve_if_implicit_return!(:string_concatenation, {name_variable: solution.first_parameter_name}) if solution.uses_string_concatenation?
8888

8989
# format("One for %s, one for me.", name)
9090
approve_if_implicit_return!(:kernel_format, {name_variable: solution.first_parameter_name}) if solution.uses_kernel_format?

lib/analyzers/two_fer/representation.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def string_interpolation_is_correct?
3737
end
3838

3939
# "One for " + name + ", one for me."
40-
def uses_string_building?
40+
def uses_string_concatenation?
4141
loc = single_line_body
4242

4343
loc.method_name == :+ &&

test/exercises/two_fer_test.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def self.two_fer(*foos)
149149
# ### 
150150
# Now let's guard against string building
151151
# ###
152-
def test_for_string_building
152+
def test_for_string_concatenation
153153
#skip
154154
source = %q{
155155
class TwoFer
@@ -160,7 +160,7 @@ def self.two_fer(name="you")
160160
}
161161
results = TwoFer::Analyze.(source)
162162
assert_equal :approve, results[:status]
163-
assert_equal [{comment: "ruby.two-fer.avoid_string_building", params: {name_variable: :name}}], results[:comments]
163+
assert_equal [{comment: "ruby.two-fer.avoid_string_concatenation", params: {name_variable: :name}}], results[:comments]
164164
end
165165

166166
def test_for_kernel_format

0 commit comments

Comments
 (0)