Repository navigation
Conversation
getSalesforceApiVersionFor treated January as part of the Winter release of its own calendar year. That release starts in the October before, so for the whole of January the rule's floor was three versions too high. January now counts in the year before. Four dated test cases cover December, January, and February. forcedotcom/code-analyzer#2102
|
Git2Gus App is installed but the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes forcedotcom/code-analyzer#2102.
The problem
AvoidOldSalesforceApiVersionsreports API versions that are three or more years old. For the 31 days of every January its floor is three versions too high, and on 1 February it drops back by two. In January 2027, for example, the rule reports 62.0 and below, where 59.0 and below is three years old.getSalesforceApiVersionFortreats October to January as the Winter release and uses the calendar year for all four months. January belongs to the Winter release that started in the October before, so for January the year is one too high, and one year is three releases.The change
src/plugin.ts: January counts in the year before. The three branches are unchanged.test/plugin.test.ts: four dated cases, for December 2025, January 2026, January 2027, and February 2027. None of the existing cases is in January. Without the fix, the two January cases fail.package.json: the regex engine's version goes to0.41.0-SNAPSHOT.Testing
With the change, the regex engine's build, lint, and tests pass locally (83 tests of 83, with
plugin.tsat 100% coverage), and so do the snapshot version check and the package interdependency check.Compared day by day from 2024-01-01 to 2039-12-31, the fixed function differs from the current one on exactly 496 days, the 31 days of each of the 16 Januaries, and each time the current one is 3 higher.
The title
I do not have a work item number, so the title has none and the title check will fail. Please rename the pull request as you need.