openrewrite / openrewrite/rewrite

Add `SourceSet#isTest()` method

Open
#3,512 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
3.7k
Forks
570
Avg merge
13h 12m
Merged PRs (30d)
261

Description

Currently SourceSet only has a name property (getName() method). Currently, there are some recipes which use the name to derive if a source set contains test or production sources by checking if the name equals test or contains test. This will typically work (at least in Maven), but at least for Bazel the source set names will be a lot less standardized.

Since it is only the build tool which knows which source sets contain test sources, it would probably make sense if the SourceSet either declared an isTest() method or something like a getKind() method returning an enum (with values PRODUCTION, TEST, and in the future possibly others).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the SourceSet API and the recipes that infer test sources from getName(), then inspect the build-tool implementations that create source sets. Done means the API clearly identifies test source sets across tools and the affected name-based checks are updated, with tests covering production and test cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.