I'd like to write a custom CodeNarc rule that validates some aspects of Grails integration test classes. e.g. Spock integration tests should extend IntegrationSpec; not Specification.
But to do this, I need to filter on integration tests while visiting the classes in the rule, and I don't know how to do that.
One idea was to look at the source file path to see if it's in test/integration
, but I don't know if it's possible to get the source path of a file.? Any other ideas?