From c579abab9019e2726b0e6809d1022c6aae26c0ca Mon Sep 17 00:00:00 2001 From: denis-troller Date: Mon, 29 Sep 2025 20:28:15 +0000 Subject: [PATCH 1/5] Create rule S8130 --- rules/S8130/apex/metadata.json | 25 +++++++++++++++++++ rules/S8130/apex/rule.adoc | 44 ++++++++++++++++++++++++++++++++++ rules/S8130/metadata.json | 2 ++ 3 files changed, 71 insertions(+) create mode 100644 rules/S8130/apex/metadata.json create mode 100644 rules/S8130/apex/rule.adoc create mode 100644 rules/S8130/metadata.json diff --git a/rules/S8130/apex/metadata.json b/rules/S8130/apex/metadata.json new file mode 100644 index 00000000000..95013ecd6e6 --- /dev/null +++ b/rules/S8130/apex/metadata.json @@ -0,0 +1,25 @@ +{ + "title": "FIXME", + "type": "CODE_SMELL", + "status": "ready", + "remediation": { + "func": "Constant\/Issue", + "constantCost": "5min" + }, + "tags": [ + ], + "defaultSeverity": "Major", + "ruleSpecification": "RSPEC-8130", + "sqKey": "S8130", + "scope": "All", + "defaultQualityProfiles": ["Sonar way"], + "quickfix": "unknown", + "code": { + "impacts": { + "MAINTAINABILITY": "HIGH", + "RELIABILITY": "MEDIUM", + "SECURITY": "LOW" + }, + "attribute": "CONVENTIONAL" + } +} diff --git a/rules/S8130/apex/rule.adoc b/rules/S8130/apex/rule.adoc new file mode 100644 index 00000000000..3edb7d8d0d2 --- /dev/null +++ b/rules/S8130/apex/rule.adoc @@ -0,0 +1,44 @@ +FIXME: add a description + +// If you want to factorize the description uncomment the following line and create the file. +//include::../description.adoc[] + +== Why is this an issue? + +FIXME: remove the unused optional headers (that are commented out) + +//=== What is the potential impact? + +== How to fix it +//== How to fix it in FRAMEWORK NAME + +=== Code examples + +==== Noncompliant code example + +[source,apex,diff-id=1,diff-type=noncompliant] +---- +FIXME +---- + +==== Compliant solution + +[source,apex,diff-id=1,diff-type=compliant] +---- +FIXME +---- + +//=== How does this work? + +//=== Pitfalls + +//=== Going the extra mile + + +//== Resources +//=== Documentation +//=== Articles & blog posts +//=== Conference presentations +//=== Standards +//=== External coding guidelines +//=== Benchmarks diff --git a/rules/S8130/metadata.json b/rules/S8130/metadata.json new file mode 100644 index 00000000000..2c63c085104 --- /dev/null +++ b/rules/S8130/metadata.json @@ -0,0 +1,2 @@ +{ +} From 5ebb74ec8eac53a2ca8cc10f58ec6f442aad9166 Mon Sep 17 00:00:00 2001 From: denis-troller Date: Mon, 20 Oct 2025 13:34:48 +0200 Subject: [PATCH 2/5] Update rules/S8130/apex/rule.adoc in PR #5663 --- rules/S8130/apex/rule.adoc | 81 ++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 20 deletions(-) diff --git a/rules/S8130/apex/rule.adoc b/rules/S8130/apex/rule.adoc index 3edb7d8d0d2..8092dbfd646 100644 --- a/rules/S8130/apex/rule.adoc +++ b/rules/S8130/apex/rule.adoc @@ -1,16 +1,28 @@ -FIXME: add a description - -// If you want to factorize the description uncomment the following line and create the file. -//include::../description.adoc[] +This rule raises an issue when Apex code references Salesforce API versions 7.0 through 30.0, which were retired after the Summer '22 release. == Why is this an issue? -FIXME: remove the unused optional headers (that are commented out) +Salesforce retired API versions 7.0 through 20.0 after the Summer '22 release to improve platform security, performance, and maintainability. + +Using retired API versions creates several critical problems: + +**Functionality Loss**: Retired API versions no longer receive updates or bug fixes. Applications relying on these versions may experience unexpected behavior or complete failure. + +**Security Vulnerabilities**: Older API versions lack modern security enhancements and patches. This exposes applications to potential security risks that have been addressed in newer versions. + +**Integration Failures**: External systems and third-party integrations may stop working when they attempt to connect using retired API versions. This can break critical business processes. + +**Compliance Issues**: Organizations with strict compliance requirements may face audit failures when using unsupported software versions. -//=== What is the potential impact? +Salesforce provides extensive backward compatibility, but retired versions are completely removed from the platform. This means any code or configuration referencing these versions will fail at runtime. -== How to fix it -//== How to fix it in FRAMEWORK NAME +=== What is the potential impact? + +Applications using retired API versions will experience service disruptions, integration failures, and potential security vulnerabilities. Critical business processes may stop functioning, leading to operational downtime and potential data access issues. + +== How to fix it in Salesforce + +Update API version references to use a supported version (21.0 or higher). Review Salesforce release notes to choose an appropriate current version that supports your required functionality. === Code examples @@ -18,27 +30,56 @@ FIXME: remove the unused optional headers (that are commented out) [source,apex,diff-id=1,diff-type=noncompliant] ---- -FIXME +// Making a web service callout with retired API version +HttpRequest req = new HttpRequest(); +req.setEndpoint('https://myinstance.salesforce.com/services/data/v20.0/sobjects/Account'); // Noncompliant +req.setMethod('GET'); ---- ==== Compliant solution [source,apex,diff-id=1,diff-type=compliant] ---- -FIXME +// Making a web service callout with supported API version +HttpRequest req = new HttpRequest(); +req.setEndpoint('https://myinstance.salesforce.com/services/data/v58.0/sobjects/Account'); +req.setMethod('GET'); +---- + +Update WSDL imports and web service references to use supported API versions. Regenerate any auto-generated classes from updated WSDL files. + +==== Noncompliant code example + +[source,apex,diff-id=2,diff-type=noncompliant] +---- +// Web service reference with retired API version +public class MyWebService { + private static final String API_VERSION = '15.0'; // Noncompliant + private static final String ENDPOINT = 'https://login.salesforce.com/services/Soap/u/' + API_VERSION; +} ---- -//=== How does this work? +==== Compliant solution + +[source,apex,diff-id=2,diff-type=compliant] +---- +// Web service reference with supported API version +public class MyWebService { + private static final String API_VERSION = '58.0'; + private static final String ENDPOINT = 'https://login.salesforce.com/services/Soap/u/' + API_VERSION; +} +---- + +== Resources + +=== Documentation + + * Salesforce API Version Retirement - https://help.salesforce.com/s/articleView?id=000354473[Official Salesforce documentation on API version retirement timeline and migration guidance] -//=== Pitfalls + * REST API Developer Guide - https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/[Complete guide to using current Salesforce REST API versions] -//=== Going the extra mile + * API Version Selection Guide - https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_concepts_version_notes.htm[Guidelines for choosing appropriate API versions for your applications] +=== Standards -//== Resources -//=== Documentation -//=== Articles & blog posts -//=== Conference presentations -//=== Standards -//=== External coding guidelines -//=== Benchmarks + * Salesforce Platform Best Practices - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_best_practices.htm[Official Salesforce development best practices including API version management] From 3d511aea5e21c39d19d45a81312271535619e6ac Mon Sep 17 00:00:00 2001 From: denis-troller Date: Mon, 20 Oct 2025 13:34:51 +0200 Subject: [PATCH 3/5] Update rules/S8130/apex/metadata.json in PR #5663 --- rules/S8130/apex/metadata.json | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/rules/S8130/apex/metadata.json b/rules/S8130/apex/metadata.json index 95013ecd6e6..8ae0d9d8cea 100644 --- a/rules/S8130/apex/metadata.json +++ b/rules/S8130/apex/metadata.json @@ -1,25 +1,29 @@ { - "title": "FIXME", + "title": "Retired Salesforce API versions should not be used", "type": "CODE_SMELL", "status": "ready", "remediation": { - "func": "Constant\/Issue", - "constantCost": "5min" + "func": "Constant/Issue", + "constantCost": "5 min" }, "tags": [ + "salesforce", + "api", + "deprecated" ], - "defaultSeverity": "Major", + "defaultSeverity": "Blocker", "ruleSpecification": "RSPEC-8130", "sqKey": "S8130", - "scope": "All", - "defaultQualityProfiles": ["Sonar way"], + "scope": "Main", + "defaultQualityProfiles": [ + "Sonar way" + ], "quickfix": "unknown", "code": { "impacts": { - "MAINTAINABILITY": "HIGH", - "RELIABILITY": "MEDIUM", - "SECURITY": "LOW" + "RELIABILITY": "BLOCKER", + "MAINTAINABILITY": "BLOCKER" }, "attribute": "CONVENTIONAL" } -} +} \ No newline at end of file From 560482bb3e148c8e6991ecc5c8ce316203eb6465 Mon Sep 17 00:00:00 2001 From: denis-troller Date: Mon, 20 Oct 2025 13:37:18 +0200 Subject: [PATCH 4/5] Update rule.adoc --- rules/S8130/apex/rule.adoc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rules/S8130/apex/rule.adoc b/rules/S8130/apex/rule.adoc index 8092dbfd646..5f34dabef1e 100644 --- a/rules/S8130/apex/rule.adoc +++ b/rules/S8130/apex/rule.adoc @@ -1,8 +1,9 @@ -This rule raises an issue when Apex code references Salesforce API versions 7.0 through 30.0, which were retired after the Summer '22 release. +This rule raises an issue when Apex code references Salesforce API versions 7.0 through 30.0, which were retired after the Summer '22 release, or 21.0 through 30.0, which were retired after the Simmer '25 release. + == Why is this an issue? -Salesforce retired API versions 7.0 through 20.0 after the Summer '22 release to improve platform security, performance, and maintainability. +Salesforce retired API versions 7.0 through 20.0 after the Summer '22 release, and API version 21.0 through 30.0 after the Summer '25 release, to improve platform security, performance, and maintainability. Using retired API versions creates several critical problems: @@ -74,7 +75,9 @@ public class MyWebService { === Documentation - * Salesforce API Version Retirement - https://help.salesforce.com/s/articleView?id=000354473[Official Salesforce documentation on API version retirement timeline and migration guidance] + * Salesforce API Version 7.0-20.0 Retirement - https://help.salesforce.com/s/articleView?id=000380623&type=1[Official Salesforce documentation on API version retirement timeline and migration guidance] + + * Salesforce API Version 21.0-30.0 Retirement - https://help.salesforce.com/s/articleView?id=000389618&type=1[Official Salesforce documentation on API version retirement timeline and migration guidance] * REST API Developer Guide - https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/[Complete guide to using current Salesforce REST API versions] From 0e61b44552b61ae11b6035d561ceb72282fb4b9a Mon Sep 17 00:00:00 2001 From: denis-troller Date: Mon, 20 Oct 2025 13:38:27 +0200 Subject: [PATCH 5/5] Update rule.adoc --- rules/S8130/apex/rule.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/S8130/apex/rule.adoc b/rules/S8130/apex/rule.adoc index 5f34dabef1e..fbe27a61bb1 100644 --- a/rules/S8130/apex/rule.adoc +++ b/rules/S8130/apex/rule.adoc @@ -1,4 +1,4 @@ -This rule raises an issue when Apex code references Salesforce API versions 7.0 through 30.0, which were retired after the Summer '22 release, or 21.0 through 30.0, which were retired after the Simmer '25 release. +This rule raises an issue when Apex code references Salesforce API versions 7.0 through 30.0, which were retired after the Summer '22 release, or 21.0 through 30.0, which were retired after the Summer '25 release. == Why is this an issue?