Skip to content

[apex] Remove class name suffix "Test" as indicator of test classes - #6563

Merged
adangel merged 5 commits into
pmd:mainfrom
dschach:main
Apr 7, 2026
Merged

adangel merged 5 commits into
pmd:mainfrom
dschach:main

Conversation

@dschach

@dschach dschach commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

The only indicator of an Apex test class should be the isTest() property

Describe the PR

The existing code was indicating that any class with @IsTest annotation OR ending in Test was a test class.

The only way to identify an Apex test class should be the annotation check.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

The only indicator of an Apex test class should be the isTest() property
@codacy-production

codacy-production Bot commented Apr 1, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@dschach
dschach marked this pull request as ready for review April 1, 2026 17:35
@pmd-actions-helper

pmd-actions-helper Bot commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.

Regression Tester Report

(comment created at 2026-04-07 17:32:40+00:00 for 415f5cf)

@dschach

dschach commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

@adangel Updated Apex check for test class to look only at IsTest annotation in the helper class.

Please see the referenced issues for context.

I had to update another test because it relied on the class name filter; I updated it to use the annotation, as that is an Apex requirement anyway.

Comment thread pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/internal/Helper.java Outdated
@adangel adangel added this to the 7.24.0 milestone Apr 7, 2026
@adangel adangel changed the title [apex] Remove class name as indicator of test class in helper Java [apex] Remove class name suffix "Test" as indicator of test classes Apr 7, 2026

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

adangel added a commit that referenced this pull request Apr 7, 2026
@adangel
adangel merged commit 415f5cf into pmd:main Apr 7, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants