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
893874a
NEW: @W-17576074@: Create github action to make rollback operation of…
stephen-carter-at-sf Jan 10, 2025
ef419e5
Remove unneeded check for users
stephen-carter-at-sf Jan 10, 2025
4972371
Merge pull request #1715 from forcedotcom/sc/W-17576074
stephen-carter-at-sf Jan 13, 2025
ee8cfb7
FIX: @W-17291574@: Fix workflow to apply tag manually
stephen-carter-at-sf Jan 13, 2025
67b14d1
Merge pull request #1717 from forcedotcom/fixWorkflow
stephen-carter-at-sf Jan 13, 2025
6fdca5b
FIX: @W-17291574@: Fix workflow to apply tag manually (attempt #2)
stephen-carter-at-sf Jan 13, 2025
62deb8a
Merge pull request #1718 from forcedotcom/fixWorkflow
stephen-carter-at-sf Jan 13, 2025
c3b5d19
FIX: @W-17291574@: Fix workflow to apply tag manually (attempt #3)
stephen-carter-at-sf Jan 13, 2025
f862a4e
Merge pull request #1719 from forcedotcom/fixWorkflow
stephen-carter-at-sf Jan 13, 2025
751ef10
Merge branch 'dev' into m2d/v5.0.0-beta.0
stephen-carter-at-sf Jan 13, 2025
77080a6
Merge pull request #1722 from forcedotcom/m2d/v5.0.0-beta.0
jag-j Jan 13, 2025
bcb18d6
FIX: @W-17590063@: Add install of python 3.10+ to publish-to-npm scri…
stephen-carter-at-sf Jan 13, 2025
41f0352
Merge pull request #1723 from forcedotcom/sc/W-17590063
stephen-carter-at-sf Jan 13, 2025
4e90ee3
CHANGE: @W-17599599@: Update @salesforce/code-analyzer-* dependencies…
stephen-carter-at-sf Jan 16, 2025
011897f
Merge pull request #1725 from forcedotcom/sc/W-17599599
stephen-carter-at-sf Jan 16, 2025
3404ddc
NEW: @W-17616013@: Add in code analyzer issue template
stephen-carter-at-sf Jan 16, 2025
28a8cee
Review feedback
stephen-carter-at-sf Jan 17, 2025
b31d65b
Merge pull request #1726 from forcedotcom/sc/W-17616013
stephen-carter-at-sf Jan 17, 2025
7b55501
CHANGE @W-17514797@ v5 release process no longer runs yarn upgrade (#…
jfeingold35 Jan 21, 2025
6da0420
CHANGE: @W-17530186@: Update dependencies where possible except for o…
stephen-carter-at-sf Jan 23, 2025
5957bea
Merge pull request #1729 from forcedotcom/sc/W-17530186
stephen-carter-at-sf Jan 23, 2025
f74f4ba
Preparing for v5.0.0-beta.1 release.
github-actions[bot] Jan 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
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_"}],
"@typescript-eslint/no-unused-vars": ["error", {
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"}],
"@typescript-eslint/unbound-method": ["error", {"ignoreStatic": true}]
},
"plugins": [
Expand Down
128 changes: 128 additions & 0 deletions .github/ISSUE_TEMPLATE/0-code_analyzer_bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Report a Bug with a code-analyzer command
description: Report an issue with a code-analyzer command.
title: "[BUG][code-analyzer] <YOUR_TITLE_HERE>"
labels: []
body:
- type: dropdown
attributes:
label: Have you tried to resolve this issue yourself first?
description: |
Oftentimes, you can resolve `code-analyzer` issues on your own. Follow these steps:
1. Read the error message.
2. Read [Salesforce Code Analyzer](https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/code-analyzer.html) documentation.
3. Double-check the command that you ran. Ensure that items like file names, method names, and category names are correctly spelled and cased.
4. Verify that your code is syntactically valid.
5. Verify that the error is reproducible on another machine.
6. Check open and closed [issues](https://github.com/forcedotcom/sfdx-scanner/issues) to see if your issue is already logged.

**I confirm that I have gone through these steps and still have an issue to report.**
<sup>(You must select "Yes" to create an issue.)</sup>
options:
- ''
- "Yes"
validations:
required: true
- type: textarea
attributes:
label: Bug Description
description: Provide a clear and concise description of what the bug is and include the exact command that you ran.
validations:
required: true
- type: textarea
attributes:
label: Output / Logs
description: Attach any output or logs here
placeholder: |
Add log output here or drag files here.
- type: textarea
attributes:
label: Steps To Reproduce
description: List out the steps that you used to reproduce the bug behavior. Be as specific and clear as possible.
placeholder: |
1. I first do ...
2. Then I do ...
3. Lastly, I do ...
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: Provide a clear and concise description of what you expected to happen.
validations:
required: true
- type: input
attributes:
label: Operating System
description: |
What is your machine's operating system?
placeholder: |
Example: MacOS Sonoma 14.4.1
validations:
required: true
- type: input
attributes:
label: Salesforce CLI Version
description: |
What do you get from the command "sf --version"?
placeholder: |
Example: @salesforce/cli/2.40.7 darwin-arm64 node-v20.12.2
validations:
required: true
- type: input
attributes:
label: Code Analyzer Plugin (code-analyzer) Version
description: |
What do you get from the command "sf plugins"?
placeholder: |
Example: code-analyzer 5.0.0-beta.0
validations:
required: true
- type: input
attributes:
label: Node Version
description: |
What do you get from the command "node --version"?
placeholder: |
Example: v23.4.0
validations:
required: false
- type: input
attributes:
label: Java Version
description: |
What do you get from the command "java -version"?
placeholder: |
Example: openjdk version "11.0.17.0.1" 2022-10-18 LTS
validations:
required: false
- type: input
attributes:
label: Python Version
description: |
What do you get from the command "python --version"?
placeholder: |
Example: Python 3.11.8
validations:
required: false
- type: textarea
attributes:
label: Additional Context (Screenshots, Files, etc)
description: Add any other context about the problem.
placeholder: |
Drag any files or screenshots you have here.
- type: textarea
attributes:
label: Workaround
description: What ways have you found to sidestep the problem? If you haven't found a workaround, what have you tried so far?
- type: dropdown
attributes:
label: Urgency
description: What is the severity of the problem?
options:
- Low
- Moderate
- High
- Critical
default: 0
validations:
required: true
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Report a Bug with scanner run
description: Report an issue with the scanner run command.
title: "[BUG] <YOUR_TITLE_HERE>"
title: "[BUG][scanner run] <YOUR_TITLE_HERE>"
labels: []
body:
- type: dropdown
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Report a Bug with scanner run dfa
description: Report an issue with the scanner run dfa command.
title: "[BUG] <YOUR_TITLE_HERE>"
title: "[BUG][scanner run dfa] <YOUR_TITLE_HERE>"
labels: []
body:
- type: dropdown
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Report a False Result with scanner run
description: Report false results in scanner run scan reports. If you're submitting your managed package for AppExchange security review, include documentation of your false results with your submission.
title: "[False Result] <YOUR_TITLE_HERE>"
title: "[False Result][scanner run] <YOUR_TITLE_HERE>"
labels: []
body:
- type: dropdown
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Report a False Result with scanner run dfa
description: Report false results returned in scanner run dfa scan reports. If you're submitting for AppExchange security review, include documentation of your false results with your submission.
title: "[False Result] <YOUR_TITLE_HERE>"
title: "[False Result][scanner run dfa] <YOUR_TITLE_HERE>"
labels: []
body:
- type: textarea
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/apply-npm-tag-to-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: apply-npm-tag-to-version
on:
workflow_dispatch:
inputs:
package_name:
description: 'Select Package Name:'
required: true
type: choice
options:
- '@salesforce/plugin-code-analyzer'
- '@salesforce/sfdx-scanner'
tag_name:
description: 'Tag Name (ex: latest):'
required: true
type: string
version:
description: 'Version (ex: 4.8.0):'
required: true
type: string
confirm:
description: 'Check this box to confirm that you understand that applying a tag using this action is only recommended for emergency rollback situations and that you understand the consequences.'
required: true
type: boolean

jobs:
publish_package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: Fail if not confirmed
if: ${{ github.event.inputs.confirm != 'true' }}
run: |
echo "::error::You did not confirm, so dist-tag not called."
exit 1

- name: Validate package name (sanity check)
if: ${{ github.event.inputs.package_name != '@salesforce/plugin-code-analyzer' && github.event.inputs.package_name != '@salesforce/sfdx-scanner' }}
run: |
echo "Invalid package name. Please choose one of the allowed package names."
exit 1

- name: Prepare NPM Credentials
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Apply tag
run: |
echo "You have confirmed that using this action is only recommended for emergency rollback situations and that you are responsible for manually applying the ${{ github.event.inputs.tag_name }} tag to ${{ github.event.inputs.package_name }}@${{ github.event.inputs.version }}."
echo "Applying tag..."
npm dist-tag add ${{ github.event.inputs.package_name }}@${{ github.event.inputs.version }} ${{ github.event.inputs.tag_name }}
11 changes: 2 additions & 9 deletions .github/workflows/create-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,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: |
yarn upgrade
# Use the GraphQL API to create a signed commit with the various changes.
- name: Commit to interim branch
run: |
Expand All @@ -50,11 +47,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_YARN_LOCK="$(cat yarn.lock | 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 query='
mutation ($message: String!, $oldOid: GitObjectID!, $branch: String!, $newPackage: Base64String!, $newYarnLock: Base64String!) {
mutation ($message: String!, $oldOid: GitObjectID!, $branch: String!, $newPackage: Base64String!) {
createCommitOnBranch(input: {
branch: {
repositoryNameWithOwner: "forcedotcom/sfdx-scanner",
Expand All @@ -68,9 +64,6 @@ jobs:
{
path: "package.json",
contents: $newPackage
}, {
path: "yarn.lock",
contents: $newYarnLock
}
]
},
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ jobs:
with:
distribution: 'temurin'
java-version: '11' # For now, Java version is hardcoded.
- uses: actions/setup-python@v5
with:
python-version: '>=3.10'
# Install SF, and the release candidate version.
- run: npm install -g @salesforce/cli
- run: sf plugins install @salesforce/plugin-code-analyzer@latest-beta-rc
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,5 @@ pmd-cataloger/bin
sfge*.log.gz

npm-shrinkwrap.json

.npmrc
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
{
"name": "@salesforce/plugin-code-analyzer",
"description": "Static code scanner that applies quality and security rules to Apex code, and provides feedback.",
"version": "5.0.0-beta.0",
"version": "5.0.0-beta.1",
"author": "Salesforce Code Analyzer Team",
"bugs": "https://github.com/forcedotcom/sfdx-scanner/issues",
"dependencies": {
"@oclif/core": "^3.3.2",
"@salesforce/code-analyzer-core": "0.20.2",
"@salesforce/code-analyzer-engine-api": "0.16.1",
"@salesforce/code-analyzer-eslint-engine": "0.17.0",
"@salesforce/code-analyzer-flowtest-engine": "0.16.2",
"@salesforce/code-analyzer-pmd-engine": "0.17.1",
"@salesforce/code-analyzer-regex-engine": "0.16.2",
"@salesforce/code-analyzer-retirejs-engine": "0.16.2",
"@salesforce/code-analyzer-core": "0.22.0",
"@salesforce/code-analyzer-engine-api": "0.17.0",
"@salesforce/code-analyzer-eslint-engine": "0.19.0",
"@salesforce/code-analyzer-flowtest-engine": "0.17.0",
"@salesforce/code-analyzer-pmd-engine": "0.19.0",
"@salesforce/code-analyzer-regex-engine": "0.17.0",
"@salesforce/code-analyzer-retirejs-engine": "0.17.0",
"@salesforce/core": "^5",
"@salesforce/sf-plugins-core": "^5.0.4",
"@salesforce/ts-types": "^2.0.9",
"@salesforce/ts-types": "^2.0.12",
"@types/js-yaml": "^4.0.9",
"@types/node": "^22.5.5",
"ansis": "^3.2.0",
"fast-glob": "^3.3.2",
"@types/node": "^22.10.9",
"ansis": "^3.9.0",
"fast-glob": "^3.3.3",
"js-yaml": "^4.1.0",
"ts-node": "^10",
"tslib": "^2"
},
"devDependencies": {
"@eslint/js": "^8.57",
"@oclif/plugin-help": "^5",
"@salesforce/cli-plugins-testkit": "^5.3.8",
"@types/jest": "^29.5.12",
"@eslint/js": "^8.57.1",
"@oclif/plugin-help": "^6.2.22",
"@salesforce/cli-plugins-testkit": "^5.3.39",
"@types/jest": "^29.5.14",
"@types/tmp": "^0.2.6",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57",
"eslint-plugin-sf-plugin": "^1.17.4",
"@typescript-eslint/eslint-plugin": "^8.21.0",
"@typescript-eslint/parser": "^8.21.0",
"eslint": "^8.57.1",
"eslint-plugin-sf-plugin": "^1.20.14",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"oclif": "^4.0.3",
"oclif": "^4.17.17",
"tmp": "^0.2.3",
"ts-jest": "^29.1.4",
"typescript": "^5.4.5"
"ts-jest": "^29.2.5",
"typescript": "^5.7.3"
},
"engines": {
"node": ">=20.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/models/ConfigModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ abstract class YamlFormatter {
private getDefaultRuleFor(engineName: string, ruleName: string): Rule|null {
try {
return this.allDefaultRules.getRule(engineName, ruleName);
} catch (e) {
} catch (_e) {
// istanbul ignore next
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/FileUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export async function exists(filename: string): Promise<boolean> {
try {
await fs.promises.access(filename, fs.constants.F_OK);
return true;
} catch (e) {
} catch (_e) {
return false;
}
}
Loading
Loading