Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

provide matchers for rspec

#30

Provide one or matchers for rspec, so that users can write examples such as this:


"def simple?() true; end".should_not smell
"def x() y + z; end".should smell_of(:UncommunicativeName, /x/)
File("example.rb").should_not smell

There's also the possibility of something such as


Dir["lib/**/*.rb"].should smell_of(:FeatureEnvy)

which may require some notion of a multi-report.

Reported by Kevin Rutherford · March 26th, 2009 @ 09:10 AM

State: resolved
Milestone: none
Assigned to: Kevin Rutherford Kevin Rutherford

Activity

  1. Kevin Rutherford
    Kevin Rutherford
    • State changed from new to open

    March 26th, 2009 @ 09:11 AM

  2. Kevin Rutherford
    Kevin Rutherford

    Code such as

    
    "def x() y + z; end".should smell_of(:UncommunicativeName, /x/)
    

    would check that the report contained an instance of UncommunicativeName, and that it's warning message matched /x/.

    The names are camel case because FeatureEnvy, for example, is the name of a class of smell :)

    March 26th, 2009 @ 09:44 AM

  3. Kevin Rutherford
    Kevin Rutherford

    So I envisage usages such as this:

    
    it 'should recognise different bad names' do
      code = "def x(z) y + z; end"
      code.should smell_of(:UncommunicativeName, /x/, /method/)
      code.should smell_of(:UncommunicativeName, /y/, /variable/)
      code.should smell_of(:UncommunicativeName, /z/, /parameter/)
    end
    

    (This will allow me to rewrite most of Reek's own examples; I don't expect general users to make much use of it.)

    March 26th, 2009 @ 09:49 AM

  4. Kevin Rutherford
    Kevin Rutherford

    Peeled off the Dir part into #32 provide rspec matcher for file lists, because it requires a bit of a rethink about design of reports and such.

    March 29th, 2009 @ 08:56 AM

  5. Kevin Rutherford
    Kevin Rutherford
    • State changed from open to resolved

    Resolved at tag v0.3.1.3, except for Dir matchers (see #32 provide rspec matcher for file lists).

    March 29th, 2009 @ 10:14 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.