Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[apex] Deprecate ApexRootNode.getApexVersion #4280

Merged
merged 2 commits into from
Jan 14, 2023

Conversation

aaronhurst-google
Copy link
Contributor

@aaronhurst-google aaronhurst-google commented Jan 4, 2023

Update the rules that utilize it. Assume Apex version is >= V176.

Describe the PR

This was discussed in #4251 in the context of replacing the Apex AST. This functionality is [feasible but] not planned for the new AST. It's also not fully certain how it behaves in the existing AST.

The two uses of ApexRootNode.getApexVersion are in AbstractApexUnitTestRule.java and ApexUnitTestShouldNotUseSeeAllDataTrueRule.java. It determines whether to also visit test methods without @IsTest if they predate the @isTest introduction API version 24. Assuming that getApexVersion actually parses the metadata API, this could lead to false negatives in rules that would otherwise fire on test-only code.

Assume Apex version is >= V176.
@pmd-test
Copy link

pmd-test commented Jan 5, 2023

1 Message
📖 Compared to master:
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.
Full report

Generated by 🚫 Danger

@adangel adangel self-requested a review January 10, 2023 11:48
@adangel adangel changed the title Deprecate ApexRootNode.getApexVersion. [apex] Deprecate ApexRootNode.getApexVersion Jan 14, 2023
@adangel adangel added the is:deprecation The main focus is deprecating public APIs or rules, eg to make them internal, or removing them label Jan 14, 2023
@adangel adangel added this to the 6.54.0 milestone Jan 14, 2023
Copy link
Member

@adangel adangel left a comment

Choose a reason for hiding this comment

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

Thanks!

@adangel
Copy link
Member

adangel commented Jan 14, 2023

Note: I didn't find any indication, that the metadata would be parsed by jorje/lsp implementation. It's probably safe to say, that this Apex version never worked as intended.

adangel added a commit to adangel/pmd that referenced this pull request Jan 14, 2023
adangel added a commit to adangel/pmd that referenced this pull request Jan 14, 2023
…sion

[apex] Deprecate ApexRootNode.getApexVersion pmd#4280
@adangel adangel merged commit 0715bd9 into pmd:master Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:deprecation The main focus is deprecating public APIs or rules, eg to make them internal, or removing them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants