Sha256: 679bbb8cb0ab3744d329d7f4233a70914ce376ce01f44107941f4e567c77865a
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 KB
Contents
Feature: Unused Private Method detector This detector is a little special in the sense that it takes class contexts but analyzes methods (and thus, is configured in regards to methods) so we need to make sure that our configuration handling still works. Scenario: Differentiate between contexts when excluding them Given a file named "config.reek" with: """ --- IrresponsibleModule: enabled: false UnusedPrivateMethod: enabled: true exclude: - "Outer::Awesome#foobar" """ And a file named "sample.rb" with: """ module Outer class Smelly private def foobar; end # Should report UnusedPrivateMethod end class Awesome private def foobar; end # Should not report UnusedPrivateMethod end end """ When I run reek -c config.reek sample.rb Then it reports: """ sample.rb -- 1 warning: [4]:UnusedPrivateMethod: Outer::Smelly has the unused private instance method 'foobar' """ Scenario: Use regexes for excluding contexts Given a file named "config.reek" with: """ --- IrresponsibleModule: enabled: false UnusedPrivateMethod: enabled: true exclude: - !ruby/regexp /(.*)wesome#foo(.*)/ """ And a file named "sample.rb" with: """ module Outer class Smelly private def foobar; end # Should report UnusedPrivateMethod end class Awesome private def foobar; end # Should not report UnusedPrivateMethod end end """ When I run reek -c config.reek sample.rb Then it reports: """ sample.rb -- 1 warning: [4]:UnusedPrivateMethod: Outer::Smelly has the unused private instance method 'foobar' """
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reek-4.8.2 | features/configuration_files/unused_private_method.feature |