Tim and team,
This should be pretty straightforward, but here goes. We use module namespaces and nested classes (too?) extensively in our project, but very rarely make direct use of inheritance. One place we do is illustrated by the following two files.
Prolog::Core::User::Validators::Name::Whitespace
is a class that, obviously, defines a protocol to check for impermissible whitespace
in a string. It has two methods, #invalid_spacing?
and #reason
, that must be overridden by subclasses that implement the protocol. Such
a class is Prolog::Core::User::Validators::Name::TrailingWs
; it implements only those two methods, which are declared private
as
documentation that they'll never be called ordinarily by outside code.
Reek doesn't like that:
$ reek --version
reek 3.9.1
$ reek lib/prolog/core/user/validators/name/trailing_ws.rb
lib/prolog/core/user/validators/name/trailing_ws.rb -- 6 warnings:
[15]:UnusedPrivateMethod: Prolog::Core::User has the unused private instance method `invalid_spacing?` [https://github.com/troessner/reek/blob/master/docs/Unused-Private-Method.md]
[19]:UnusedPrivateMethod: Prolog::Core::User has the unused private instance method `reason` [https://github.com/troessner/reek/blob/master/docs/Unused-Private-Method.md]
[15]:UnusedPrivateMethod: Prolog::Core::User::Validators::Name has the unused private instance method `invalid_spacing?` [https://github.com/troessner/reek/blob/master/docs/Unused-Private-Method.md]
[19]:UnusedPrivateMethod: Prolog::Core::User::Validators::Name has the unused private instance method `reason` [https://github.com/troessner/reek/blob/master/docs/Unused-Private-Method.md]
[15]:UnusedPrivateMethod: Prolog::Core::User::Validators::Name::TrailingWs has the unused private instance method `invalid_spacing?` [https://github.com/troessner/reek/blob/master/docs/Unused-Private-Method.md]
[19]:UnusedPrivateMethod: Prolog::Core::User::Validators::Name::TrailingWs has the unused private instance method `reason` [https://github.com/troessner/reek/blob/master/docs/Unused-Private-Method.md]
$
Almost beside the point is that tests using the code show it works properly, and that Reek is so deeply confused it reports warnings against the class and each containing class. What gives here?