[Codenarc-user] ExplicitCallToAndMethodRule: allowing explicit "and" calls for various classes?
Brought to you by:
chrismair
From: R. S. <ren...@go...> - 2011-05-26 20:34:18
|
Is it possible to allow explicit "and" calls on different classes in the ExplicitCallToAndMethodRule? doNotApplyToClassNames cannot be used because this filters only the classes that are analyzed, not the ones, "and" is called on. We are using Hamcrest a lot. It has a fluent interface which can go like this: -------------------------------------------------------------------- import static org.hamcrest.MatcherAssert.assertThat import static org.hamcrest.Matchers.* def numbers = [1, 2, 3] assertThat numbers, hasItem(both(1).and(2)) -------------------------------------------------------------------- I already had a look at the rule implementation. And as suggested in another thread I also changed the phase to OUTPUT in AbstractSourceCode. But as expected this results in a compilation error as Hamcrest is not part of CodeNarc. Any ideas how to get the desired behavior? Regards, René Scheibe |