Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .github/workflows/create-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ jobs:
git checkout -b $INTERIM_BRANCH_NAME
# Immediately push the interim branch with no changes, so GraphQL can push to it later.
git push --set-upstream origin $INTERIM_BRANCH_NAME
# Update our dependencies
- run: npm update
# Use the GraphQL API to create a signed commmit with our changes.
- run: |
# GraphQL needs to know what branch to push to.
Expand All @@ -93,11 +91,10 @@ jobs:
MESSAGE="Preparing for v$NEW_VERSION release."
# GraphQL needs the latest versions of the files we changed, as Base64 encoded strings.
NEW_PACKAGE="$(cat package.json | base64)"
NEW_LOCKFILE="$(cat package-lock.json | base64)"
gh api graphql -F message="$MESSAGE" -F oldOid=`git rev-parse HEAD` -F branch="$BRANCH" \
-F newPackage="$NEW_PACKAGE" -F newLockfile="$NEW_LOCKFILE" \
-F newPackage="$NEW_PACKAGE" \
-f query='
mutation ($message: String!, $oldOid: GitObjectID!, $branch: String!, $newPackage: Base64String!, $newLockfile: Base64String!) {
mutation ($message: String!, $oldOid: GitObjectID!, $branch: String!, $newPackage: Base64String!) {
createCommitOnBranch(input: {
branch: {
repositoryNameWithOwner: "forcedotcom/sfdx-code-analyzer-vscode",
Expand All @@ -111,9 +108,6 @@ jobs:
{
path: "package.json",
contents: $newPackage
}, {
path: "package-lock.json",
contents: $newLockfile
}
]
},
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/production-heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [{vm: ubuntu-latest}, {vm: windows-2019}, {vm: macos-latest}]
node: ['lts/*']
os:
[{ vm: ubuntu-latest }, { vm: windows-latest }, { vm: macos-latest }]
node: ["lts/*"]
runs-on: ${{ matrix.os.vm }}
timeout-minutes: 60
steps:
Expand Down
2 changes: 1 addition & 1 deletion SHA256.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ make sure that their SHA values match the values in the list below.
shasum -a 256 <location_of_the_downloaded_file>

3. Confirm that the SHA in your output matches the value in this list of SHAs.
f2f1d3d11766f331c15c1c32aa8b93a57b1626fc3e2f25a8b8b4704962198bf4 ./extensions/sfdx-code-analyzer-vscode-1.7.0.vsix
112139aa0cd29e64729aceaea9fc1c19c072b95af7eda751ca9ad92a346a9783 ./extensions/sfdx-code-analyzer-vscode-1.8.0.vsix
4. Change the filename extension for the file that you downloaded from .zip to
.vsix.

Expand Down
4,246 changes: 1,911 additions & 2,335 deletions package-lock.json

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"color": "#ECECEC",
"theme": "light"
},
"version": "1.8.0",
"version": "1.9.0",
"publisher": "salesforce",
"license": "BSD-3-Clause",
"engines": {
Expand All @@ -34,39 +34,39 @@
],
"dependencies": {
"@salesforce/vscode-service-provider": "^1.4.0",
"@types/jest": "^29.5.14",
"@types/semver": "^7.5.8",
"@types/jest": "^30.0.0",
"@types/semver": "^7.7.0",
"@types/tmp": "^0.2.6",
"diff": "^5.2.0",
"glob": "^11.0.1",
"semver": "^7.7.1",
"glob": "^11.0.3",
"semver": "^7.7.2",
"tmp": "^0.2.3"
},
"devDependencies": {
"@eslint/js": "^9.21.0",
"@types/diff": "^5.2.0",
"@types/chai": "^4.3.5",
"@types/mocha": "^10.0.1",
"@types/node": "^22.13.6",
"@types/sinon": "^10.0.15",
"@types/vscode": "^1.74.0",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.4.1",
"@vscode/vsce": "^3.2.2",
"chai": "^4.3.7",
"esbuild": "^0.25.0",
"eslint": "^9.21.0",
"jest": "^29.7.0",
"jest-mock-vscode": "^4.2.0",
"mocha": "^10.1.0",
"ovsx": "^0.10.1",
"@eslint/js": "^9.31.0",
"@types/diff": "^5.2.3",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/node": "^22.16.4",
"@types/sinon": "^10.0.20",
"@types/vscode": "^1.90.0",
"@vscode/test-cli": "^0.0.11",
"@vscode/test-electron": "^2.5.2",
"@vscode/vsce": "^3.6.0",
"chai": "^4.5.0",
"esbuild": "^0.25.6",
"eslint": "^9.31.0",
"jest": "^30.0.4",
"jest-mock-vscode": "^4.5.0",
"mocha": "^10.8.2",
"ovsx": "^0.10.5",
"proxyquire": "^2.1.3",
"rimraf": "*",
"sinon": "^15.1.0",
"ts-jest": "^29.2.6",
"ts-node": "^10.9.1",
"typescript": "^5.7.3",
"typescript-eslint": "^8.25.0"
"sinon": "^15.2.0",
"ts-jest": "^29.4.0",
"ts-node": "^10.9.2",
"typescript": "^5.8.3",
"typescript-eslint": "^8.37.0"
},
"extensionDependencies": [
"salesforce.salesforcedx-vscode-core"
Expand Down
59 changes: 52 additions & 7 deletions src/lib/agentforce/supported-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,73 @@ export enum ViolationContextScope {
*/
export const A4D_SUPPORTED_RULES: Map<string, ViolationContextScope> = new Map([
// =======================================================================
// ==== Rules from rule selector: 'pmd:Recommended:Documentation:Apex'
// ==== Rules from rule selector: 'pmd:Documentation:Apex'
// =======================================================================
['ApexDoc', ViolationContextScope.MethodScope],


// =======================================================================
// ==== Rules from rule selector: 'pmd:Recommended:ErrorProne:Apex'
// ==== Rules from rule selector: 'pmd:BestPractices:Apex'
// =======================================================================
['ApexAssertionsShouldIncludeMessage', ViolationContextScope.ViolationScope],
['ApexUnitTestMethodShouldHaveIsTestAnnotation', ViolationContextScope.ClassScope],
['ApexUnitTestShouldNotUseSeeAllDataTrue', ViolationContextScope.ClassScope], // Range really should just be the violation but see ApexUnitTestShouldNotUseSeeAllDataTrue
['UnusedLocalVariable', ViolationContextScope.ViolationScope],
// NOTE: We have decided that the following `BestPractices` rules either do not get any value from A4D Quick Fix
// suggestions or that the model currently gives back poor suggestions:
// ApexUnitTestClassShouldHaveAsserts, ApexUnitTestClassShouldHaveRunAs, AvoidGlobalModifier, AvoidLogicInTrigger,
// DebugsShouldUseLoggingLevel, QueueableWithoutFinalizer

// =======================================================================
// ==== Rules from rule selector: 'pmd:CodeStyle:Apex'
// =======================================================================
['ClassNamingConventions', ViolationContextScope.ViolationScope],
['FieldDeclarationsShouldBeAtStart', ViolationContextScope.ClassScope],
['FieldNamingConventions', ViolationContextScope.ViolationScope],
['ForLoopsMustUseBraces', ViolationContextScope.ViolationScope],
['FormalParameterNamingConventions', ViolationContextScope.ViolationScope],
['LocalVariableNamingConventions', ViolationContextScope.ViolationScope],
['MethodNamingConventions', ViolationContextScope.ViolationScope],
['OneDeclarationPerLine', ViolationContextScope.ViolationScope],
['PropertyNamingConventions', ViolationContextScope.ViolationScope],
// NOTE: We have decided that the following `CodeStyle` rules either do not get any value from A4D Quick Fix
// suggestions or that the model currently gives back poor suggestions:
// IfElseStmtsMustUseBraces, IfStmtsMustUseBraces, WhileLoopsMustUseBraces


// =======================================================================
// ==== Rules from rule selector: 'pmd:Design:Apex'
// =======================================================================
['AvoidDeeplyNestedIfStmts', ViolationContextScope.MethodScope],
// NOTE: We have decided that the following `Design` rules either do not get any value from A4D Quick Fix
// suggestions or that the model currently gives back poor suggestions:
// CognitiveComplexity, CyclomaticComplexity, ExcessiveClassLength, ExcessiveParameterList, ExcessivePublicCount,
// NcssConstructorCount, NcssMethodCount, NcssTypeCount, StdCyclomaticComplexity, TooManyFields, UnusedMethod


// =======================================================================
// ==== Rules from rule selector: 'pmd:ErrorProne:Apex'
// =======================================================================
['AvoidDirectAccessTriggerMap', ViolationContextScope.MethodScope],
['InaccessibleAuraEnabledGetter', ViolationContextScope.MethodScope],
['MethodWithSameNameAsEnclosingClass', ViolationContextScope.MethodScope],
['OverrideBothEqualsAndHashcode', ViolationContextScope.ViolationScope],
['TestMethodsMustBeInTestClasses', ViolationContextScope.ClassScope],
// NOTE: We have decided that the following `ErrorProne` rules either do not get any value from A4D Quick Fix
// suggestions or that the model currently gives back poor suggestions:
// AvoidHardcodingId, AvoidNonExistentAnnotations, EmptyCatchBlock, EmptyIfStmt, EmptyStatementBlock,
// EmptyTryOrFinallyBlock, EmptyWhileStmt, MethodWithSameNameAsEnclosingClass
// EmptyTryOrFinallyBlock, EmptyWhileStmt
// NOTE: New rules like AvoidStatefulDatabaseResult and TypeShadowsBuiltInNamespace have yet to be evaluated.


// =======================================================================
// ==== Rules from rule selector: 'pmd:Recommended:Security:Apex'
// ==== Rules from rule selector: 'pmd:Performance:Apex'
// =======================================================================
// All the performance rules have yet to be evaluated.


// =======================================================================
// ==== Rules from rule selector: 'pmd:Security:Apex'
// =======================================================================
['ApexBadCrypto', ViolationContextScope.MethodScope],
['ApexCRUDViolation', ViolationContextScope.MethodScope],
Expand All @@ -51,7 +98,5 @@ export const A4D_SUPPORTED_RULES: Map<string, ViolationContextScope> = new Map([
// NOTE: We have decided that the following `Security` rule(s) either do not get any value from A4D Quick Fix
// suggestions or that the model currently gives back poor suggestions:
// ApexOpenRedirect


// NOTE: We still need to evaluate other rule categories, so more will come in future releases.
// NOTE: AppExchange rules have not been evaluated.
]);
1 change: 1 addition & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

// extension names
export const EXTENSION_ID = 'salesforce.sfdx-code-analyzer-vscode';
export const EXTENSION_BASE_ID = 'sfdx-code-analyzer-vscode';
export const CORE_EXTENSION_ID = 'salesforce.salesforcedx-vscode-core';
export const EXTENSION_PACK_ID = 'salesforce.salesforcedx-vscode';

Expand Down
3 changes: 3 additions & 0 deletions src/lib/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ export class CodeAnalyzerDiagnostic extends vscode.Diagnostic {
const rulesToReduceViolationsToSingleLine: string[] = [
'ApexDoc', // https://github.com/pmd/pmd/issues/5614
'ApexUnitTestMethodShouldHaveIsTestAnnotation', // https://github.com/pmd/pmd/issues/5669
'ApexUnitTestShouldNotUseSeeAllDataTrue', // https://github.com/pmd/pmd/issues/5904
'AvoidGlobalModifer', // https://github.com/pmd/pmd/issues/5668
'ApexSharingViolations', // https://github.com/pmd/pmd/issues/5511
'ClassNamingConventions', // https://github.com/pmd/pmd/issues/5905
'MethodWithSameNameAsEnclosingClass', // https://github.com/pmd/pmd/issues/5906
'ExcessiveParameterList']; // https://github.com/pmd/pmd/issues/5616
if (rulesToReduceViolationsToSingleLine.includes(violation.rule)) {
diagnostic.range = new vscode.Range(diagnostic.range.start.line, diagnostic.range.start.character,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/external-services/external-service-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class ExternalServiceProvider implements LLMServiceProvider, TelemetrySer
}

try {
const coreTelemetryService: TelemetryServiceInterface = await ServiceProvider.getService(ServiceType.Telemetry);
const coreTelemetryService: TelemetryServiceInterface = await ServiceProvider.getService(ServiceType.Telemetry, Constants.EXTENSION_BASE_ID);
await coreTelemetryService.initializeService(this.extensionContext);
return new LiveTelemetryService(coreTelemetryService, this.logger);
} catch (err) {
Expand Down
Loading