Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8e5219d
Updating SHA256.md after 1.4.0 release
svc-cli-bot Feb 25, 2025
a39e4a6
Merge pull request #179 from forcedotcom/m2d/v1.4.0
jfeingold35 Feb 25, 2025
1aaf2cb
NEW (Extension) @W-17865130@ Fix formatting and multiples violations …
jag-j Feb 26, 2025
e9cff2c
NEW (Extension) @W-17865130@ Fix indentation for paranthesis and squ…
jag-j Feb 28, 2025
5d5a764
NEW (Extension) @W-17865130@ Save and rerun analyzer when fixes are …
jag-j Feb 28, 2025
ac57e93
CHANGE: @W-17950421@: Update dependencies, switch to npm, and fix lin…
stephen-carter-at-sf Feb 28, 2025
12f551d
Add in type checking for eslint
stephen-carter-at-sf Mar 3, 2025
9d5efe5
Remove await in cases where it is causing issues for now
stephen-carter-at-sf Mar 3, 2025
d609e27
CHANGE: @W-17950421@: Update how we validate PR titles (#184)
stephen-carter-at-sf Mar 3, 2025
06f79f7
CHANGE: @W-17950421@: Remove the unneeded runTest wrapper, remove nyc…
stephen-carter-at-sf Mar 4, 2025
fccf83e
CHANGE: @W-17950421@: Add in the ability to run jest unit tests while…
stephen-carter-at-sf Mar 4, 2025
e402d5d
@W-17526120@ Added improved telemetry for A4D events
jfeingold35 Mar 5, 2025
20fdbd4
CHANGE: @W-17970149@: The beginnings of refactorings to start removin…
stephen-carter-at-sf Mar 5, 2025
2ba9d3c
CHANGE: @W-17970149@: Some more refactoring to remove remaining globa…
stephen-carter-at-sf Mar 6, 2025
38c78b7
FIX: @W-17821243@: Quick fix to external service race condition issue…
stephen-carter-at-sf Mar 7, 2025
c9a50a7
CHANGE: @W-17821243@: Update our LLM prompt with guided json and turn…
stephen-carter-at-sf Mar 14, 2025
247fd71
NEW(a4d): @W-17617362@: Send in context range dependent upon the rule…
stephen-carter-at-sf Mar 18, 2025
9a62ec2
FIX: @W-18088088@: Fix a few low hanging bugs (#194)
stephen-carter-at-sf Mar 20, 2025
0c90638
FIX: @W-18089438@: Stop diff tool from trimming hunks unnecessarily (…
stephen-carter-at-sf Mar 20, 2025
f125e21
Preparing for v1.5.0 release.
github-actions[bot] Mar 21, 2025
b11dc57
CHANGE: @W-18088088@: Rename Agentforce to Agentforce for Developers …
stephen-carter-at-sf Mar 21, 2025
1f0f202
NEW: @W-18088088@: Add warning if using v4 still (#197)
stephen-carter-at-sf Mar 24, 2025
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
root = true

[*]
indent_style = tab
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
Expand Down
27 changes: 0 additions & 27 deletions .eslintrc.json

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/create-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 'lts/*' # Always use Node LTS for building dependencies.
- run: yarn install --frozen-lockfile
- run: npm ci
# Increment the version as desired locally, without actually committing anything.
- name: Locally increment version
run: |
Expand All @@ -85,7 +85,7 @@ jobs:
# 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: yarn upgrade
- 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 @@ -95,11 +95,11 @@ 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_YARN_LOCK="$(cat yarn.lock | 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 newYarnLock="$NEW_YARN_LOCK" \
-F newPackage="$NEW_PACKAGE" -F newLockfile="$NEW_LOCKFILE" \
-f query='
mutation ($message: String!, $oldOid: GitObjectID!, $branch: String!, $newPackage: Base64String!, $newYarnLock: Base64String!) {
mutation ($message: String!, $oldOid: GitObjectID!, $branch: String!, $newPackage: Base64String!, $newLockfile: Base64String!) {
createCommitOnBranch(input: {
branch: {
repositoryNameWithOwner: "forcedotcom/sfdx-code-analyzer-vscode",
Expand All @@ -114,8 +114,8 @@ jobs:
path: "package.json",
contents: $newPackage
}, {
path: "yarn.lock",
contents: $newYarnLock
path: "package-lock.json",
contents: $newLockfile
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-vsix-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
node-version: 'lts/*' # Node LTS should always be fine.
- name: 'Install node dependencies'
run: yarn install --frozen-lockfile
run: npm ci
- name: 'Create VSIX'
run: npx vsce package
- name: 'Upload artifact'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
with:
distribution: 'temurin'
java-version: '11'
- run: yarn install --frozen-lockfile
- run: npm ci
# Download the .vsix attached to the release.
- name: Download Extension From Release
run: |
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
with:
distribution: 'temurin'
java-version: '11'
- run: yarn install --frozen-lockfile
- run: npm ci
# Download the .vsix attached to the release.
- name: Download Extension From Release
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
with:
python-version: 3.12
- name: 'Install node module dependencies'
run: yarn install --frozen-lockfile
run: npm ci
# We'll need to install the CLI tool, since some of the tests
# are integration tests.
- name: Install SF CLI
Expand Down Expand Up @@ -115,14 +115,14 @@ jobs:
run: sf plugins install code-analyzer
# Run the tests. (Linux and non-Linux need slightly different commands.)
- name: 'Run Tests (Linux)'
run: xvfb-run -a yarn test
run: xvfb-run -a npm run test
if: runner.os == 'Linux'
- name: 'Run Tests (non-Linux)'
run: yarn test
run: npm run test
if: runner.os != 'Linux'
# Lint, to make sure we're following best practices.
- name: 'Lint'
run: yarn lint
run: npm run lint
# Upload the code coverage from the test as an artifact with
# the name 'code-coverage-[whatever the OS is]'.
- name: Upload coverage artifact
Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,32 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Verify PR Title
uses: ./github-actions/verify-pr-title
id: verify_pr_title
run: |
title="${{ github.event.pull_request.title }}"
title_upper=$(echo "$title" | tr '[:lower:]' '[:upper:]')
base_ref="${{ github.base_ref }}"

# Define regex patterns for different types of PR titles
MAIN2DEV_REGEX="^MAIN2DEV[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.*MERGING.+[[:digit:]]{1,2}\.[[:digit:]]{1,2}\.[[:digit:]]{1,2}.*"
RELEASE2MAIN_REGEX="^RELEASE[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.+"
PR_INTO_DEV_OR_RELEASE_REGEX="^(FIX|CHANGE|NEW)([[:space:]]*\([^)]+\))?[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.+"

# Validate PR title based on base_ref and head_ref
if [[ "$base_ref" == "dev" && "${{ startsWith(github.head_ref, 'm2d/') }}" == "true" && ! "$title_upper" =~ $MAIN2DEV_REGEX ]]; then
echo "::error::Invalid PR title: '$title'. Please follow the format: Main2Dev (__) @W-XXXXXXXX@ Merging.*\d+\.\d+\.\d+"
exit 1
elif [[ "$base_ref" == "main" && ! "$title_upper" =~ $RELEASE2MAIN_REGEX ]]; then
echo "::error::Invalid PR title: '$title'. Please follow the format: RELEASE @W-XXXXXXXX@ Summary"
exit 1
elif [[ ("$base_ref" == "dev" || "${{ startsWith(github.base_ref, 'release-') }}" == "true") && ! "$title_upper" =~ $PR_INTO_DEV_OR_RELEASE_REGEX ]]; then
echo "::error::Invalid PR title: '$title'. Please follow the format: FIX|CHANGE|NEW (__) @W-XXXXXXXX@ Summary"
exit 1
else
echo "PR title '$title' automatically accepted for $base_ref branch."
fi

# If no errors, print success
echo "Valid PR title: '$title'"
# RUN TESTS
# Step 1: Build the scanner tarball so it can be installed locally.
build_v4_scanner_tarball:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ node_modules
**/.DS_Store
coverage
typescript-test-results
.nyc_output/
17 changes: 17 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from '@vscode/test-cli';
import { fileURLToPath } from "url";
import { dirname } from "path";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

export default defineConfig({
tests: [{
files: `./out/test/legacy/**/*.test.js`,
installExtensions: ['salesforce.salesforcedx-vscode']
}],
coverage: {
includeAll: true,
reporter: ["text", "lcov"]
}
});
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
"--extensionTestsPath=${workspaceFolder}/out/test/legacy/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
Expand Down
32 changes: 17 additions & 15 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
.vscode/**
.vscode-test/**
src/**
.git2gus/**
.github/**
.gitignore
.yarnrc
.idea/**
.nyc_output/**
.sfdx
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
.vscode-test/**
.vscode/**
CODEOWNERS
code-fixtures/**
coverage/**
esbuild.js
github-actions/**
templates/**
.git2gus/**
.github/**
!out/extension.js
node_modules/**
out/**
node_modules/
!out/extension.js
src/**
templates/**
**/*.map
**/*.ts
**/.vscode-test.*
**/eslint.config.mjs
**/tsconfig.json
**/jest.config.mjs
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

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.
9fd5830fd646e931d9b7156f97c15872e3739b0d5bfe3085fb65128b6829b3f4 ./extensions/sfdx-code-analyzer-vscode-1.3.0.vsix
b148099eb0950f4001441d6e527f5e0333ac48abf865dbc2b2089551071504df ./extensions/sfdx-code-analyzer-vscode-1.4.0.vsix
4. Change the filename extension for the file that you downloaded from .zip to
.vsix.

Expand Down
79 changes: 54 additions & 25 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,60 @@
/**
* Copyright (c) 2023, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
**/
/* eslint-disable @typescript-eslint/no-var-requires */
const { build } = require('esbuild');
const esbuild = require("esbuild");

const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');

/**
* TODO: We have entryPoints and outfile to be the same since runTests looks for the extension's main to be at
* 'out/' as defined in package.json.We should refactor the tests not to rely on package.json and until then,
* the entryPoints and outfile will be the same with allowOverwrite set ti true.
* @type {import('esbuild').Plugin}
*/
build({
entryPoints: ['out/extension.js'],
bundle: true,
platform: 'node',
target: 'es2020',
outfile: 'out/extension.js',
format: 'cjs',
external: ['vscode'],
sourcemap: !production,
minify: production,
allowOverwrite: true
}).catch((e) => {
console.error(e);
NodeJS.process.exit(1);
const esbuildProblemMatcherPlugin = {
name: 'esbuild-problem-matcher',

setup(build) {
build.onStart(() => {
console.log('[watch] build started');
});
build.onEnd((result) => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
console.error(` ${location.file}:${location.line}:${location.column}:`);
});
console.log('[watch] build finished');
});
},
};

async function main() {
const ctx = await esbuild.context({
entryPoints: [
'src/extension.ts'
],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'node',
/* This really should be dist/extensions.js and then the package.json's main should point to dist/extension.js instead of overriding our out folder's extension.js file....
but for some reason our tests that run with vscode-test use the package.json's main entry point as a means of finding our extension that we then call the activate method on.
TODO: Figure out a way to get vscode-test to discover the extension without using the main. Then we can fix the main and this esbuild config to separate the minified code
into a dist folder. */
outfile: 'out/extension.js',
external: ['vscode'],
logLevel: 'silent',
plugins: [
/* add to the end of plugins array */
esbuildProblemMatcherPlugin,
],
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
}

main().catch(e => {
console.error(e);
process.exit(1);
});
28 changes: 28 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{
files: ["**/*.ts"],
},
{
ignores: ["**/*.mjs", "**/*.js"],
},
eslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsConfigRootDir: "src"
}
},
rules: {
"@typescript-eslint/no-unused-vars": ["error", {
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}]
}
}
);
Loading