== Why is this an issue? While some ``++TestRule++`` classes have the desired effect without ever being directly referenced by a test, several others do not, and there's no reason to leave them cluttering up the file if they're not in use. This rule raises an issue when ``++Test++`` class fields of the following types aren't used by any of the test methods: ``++TemporaryFolder++``, and ``++TestName++``. This rule also applies to the JUnit 5 equivalent classes: ``++TempDir++``, and ``++TestInfo++``. === Noncompliant code example [source,java] ---- public class ProjectDefinitionTest { @Rule public TemporaryFolder temp = new TemporaryFolder(); // Noncompliant @Test public void shouldSetKey() { ProjectDefinition def = ProjectDefinition.create(); def.setKey("mykey"); assertThat(def.getKey(), is("mykey")); } } ---- === Compliant solution [source,java] ---- public class ProjectDefinitionTest { @Test public void shouldSetKey() { ProjectDefinition def = ProjectDefinition.create(); def.setKey("mykey"); assertThat(def.getKey(), is("mykey")); } } ---- ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) === Message Remove this unused "TestRule". ''' == Comments And Links (visible only on this page) === on 12 May 2015, 14:25:37 Ann Campbell wrote: \[~david.gageot] this may not be as broad as you wanted...? Also, I'm not quite sure about the impact of the @Rule annotation, so I didn't mention it in the description but left it in the code sample you provided. What happens if the annotation is missing? === on 12 May 2015, 14:54:12 David Gageot wrote: If the annotation is missing, it will not do anything either. So this is really dead code === on 12 May 2015, 14:54:16 David Gageot wrote: lgtm endif::env-github,rspecator-view[]