Created
April 18, 2017 20:14
-
-
Save cobbr2/8ba8523fea3a9c08811211a608a60ab6 to your computer and use it in GitHub Desktop.
4 reek UtilityFunction cases; only one should smell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test case for disabling utility function smells. Should smell like | |
# UtilityFunction | |
class NoSuppression | |
def utility_function | |
STDOUT.puts "I'm a utility function" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Should suppress utility function smell; in my real code, does work. | |
class SuppressInPrivateSection | |
private | |
# :reek:UtilityFunction | |
def utility_function | |
STDOUT.puts "I'm a utility function" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Should suppress disable utility function smell; does not for me. | |
class SuppressOnPrivateDef | |
# :reek:UtilityFunction | |
private def utility_function | |
STDOUT.puts "I'm a utility function" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Should disable utility function smell; works | |
class SuppressOnPublicMethod | |
# :reek:UtilityFunction | |
def utility_function | |
STDOUT.puts "I'm a utility function" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ reek * | |
Inspecting 4 file(s): | |
S.S. | |
no_suppression.rb -- 1 warning: | |
[4]:UtilityFunction: NoSuppression#utility_function doesn't depend on instance state (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Utility-Function.md] | |
suppress_on_private_def.rb -- 1 warning: | |
[4]:UtilityFunction: SuppressOnPrivateDef#utility_function doesn't depend on instance state (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Utility-Function.md] | |
2 total warnings |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment