-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from forcedotcom/d/W-14689557
@W-14689557@: Update user text, README.md, and CONTRIBUTING.md
- Loading branch information
Showing
3 changed files
with
161 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,91 @@ | ||
# Contributing Guide | ||
> At the moment, we are not accepting external contributions. Please watch this space to know when we open. | ||
# Contributing Guide for the 'Run Salesforce Code Analyzer' GitHub Action | ||
> Currently, we aren't accepting external contributions. To know when we open for contributions, periodically check this guide. | ||
To contribute to the Run Code Analyzer GitHub Action, read this guide to understand its operational governance model. This guide also provides contribution requirements and recommendations. Thanks for your interest and contributions. | ||
|
||
# Governance Model | ||
|
||
## Salesforce Sponsored | ||
|
||
The intent and goal of open sourcing this project is to increase the contributor and user base. Note that Salesforce employees have `admin` rights and are the final arbiters which contributions are accepted. | ||
|
||
# Issues, requests & ideas | ||
|
||
To submit issues, enhancement requests, and discuss ideas, create an issue on the [Issues page](https://github.com/forcedotcom/run-code-analyzer/issues). | ||
|
||
### Bug Reports and Fixes | ||
- If you find a bug, search for it in the [Issues](https://github.com/forcedotcom/run-code-analyzer/issues), and if it isn't already tracked, | ||
[create a new issue](https://github.com/forcedotcom/run-code-analyzer/issues/new). Fill out the "Bug Report" section of the issue template. Even if an issue is closed, feel free to comment and add details, it will still be reviewed. | ||
- Issues that have been confirmed as a bug will be labelled `bug`. | ||
- If you want to submit a bug fix, [create a pull request](#creating_a_pull_request) and mention the issue number. | ||
- In your bug fix pull request, include tests that isolate the bug and verify that it's fixed. | ||
|
||
### New Features | ||
- To add new functionality to Run Code Analyzer, describe the problem you want to solve - or the enhancement you identifed - in a [new issue](https://github.com/forcedotcom/run-code-analyzer/issues/new). | ||
- Issues that are identified as a feature request are labelled `enhancement`. | ||
- Before writing the code for your newly requested feature, first wait for feedback from the project maintainers. In some cases, requested `enhancements` don't align well with the current project objectives. | ||
|
||
### Tests, Documentation, Miscellaneous | ||
- We welcome your contributions to: | ||
- improving tests | ||
- clarifying documentation | ||
- requesting alternative implementations | ||
- If it's a trivial change, go ahead and [create a pull request](#creating_a_pull_request) with the changes you have in mind. | ||
- If your request is larger in size, [open an issue](https://github.com/forcedotcom/run-code-analyzer/issues/new) to get feedback on your idea. | ||
|
||
# Contribution Checklist | ||
|
||
- [x] Clean, simple, well styled code | ||
- [x] Atomic commits and descriptive messages. Mention related issues by issue number | ||
- [x] Comments | ||
- Module-level & function-level comments | ||
- Comments on complex blocks of code or algorithms (include references to sources) | ||
- [x] Tests | ||
- Complete, passing test suite test suite (if provided) | ||
- Maintain or increase code coverage percentages | ||
- [x] Dependencies | ||
- Minimize number of dependencies | ||
- Prefer Apache 2.0, BSD3, MIT, ISC and MPL licenses | ||
- [x] Reviews | ||
- Approved peer code review changes | ||
|
||
# Local Development | ||
|
||
## Install Dependencies | ||
Install required node dependencies: | ||
``` | ||
npm install | ||
``` | ||
|
||
## Running tests | ||
We strive for 100% code coverage. | ||
After making your changes, run your tests and check coverage with: | ||
``` | ||
npm run test | ||
``` | ||
|
||
## Before submitting | ||
We use `ncc` to produce a single *index.js* file inside the *dist* directory from all the typescript source code. | ||
Before you submit, create this package along with license files, and badges with: | ||
``` | ||
npm run all | ||
``` | ||
|
||
# Creating a Pull Request | ||
|
||
1. **Ensure the bug or feature wasn't already reported** by searching on GitHub under Issues. If none exists, create a new issue so that other contributors can keep track of what you are trying to add or fix and offer suggestions, or let you know if there is already an effort in progress. | ||
3. **Clone** the forked repo to your machine. | ||
4. **Create** a new branch to contain your work. Example: `git br fix-issue-11` | ||
4. **Commit** changes to your own branch. | ||
5. **Push** your work back up to your fork. Example: `git push fix-issue-11` | ||
6. **Submit** a pull request against the `main` branch and refer to the issue you're fixing. Keep your pull request simple and small to avoid any unintended changes. | ||
7. **Sign** the Salesforce Contributor License Agreement (CLA). You will be prompted to do so when submitting your pull request. | ||
|
||
> **NOTE**: Be sure to [sync your fork](https://help.github.com/articles/syncing-a-fork/) before making a pull request. | ||
|
||
# Code of Conduct | ||
Please follow our [Code of Conduct](CODE_OF_CONDUCT.md). | ||
|
||
# License | ||
By contributing your code, you agree to license your contribution under the terms of our project [LICENSE](LICENSE) and to sign the [Salesforce CLA](https://cla.salesforce.com/sign-cla) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,77 @@ | ||
# Coming soon | ||
# Run Salesforce Code Analyzer - GitHub Action | ||
|
||
[![GitHub Super-Linter](https://github.com/actions/typescript-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter) | ||
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg) | ||
[![Check dist/](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml) | ||
[![CodeQL](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml) | ||
[![Coverage](./badges/coverage.svg)](./badges/coverage.svg) | ||
|
||
This GitHub action will be available in the coming weeks. When available, we will update this README.md file. | ||
The `run-code-analyzer` GitHub Action scans your code for violations using | ||
[Salesforce Code Analyzer](https://forcedotcom.github.io/sfdx-scanner), uploads the results as an artifact, and displays | ||
the results as a job summary. | ||
|
||
# Inputs | ||
* `run-command` (Default value: `'run'`) | ||
* <b>Specifies the Salesforce Code Analyzer command to run.</b><br/> | ||
Possible values are: `'run'`, `'run dfa'`.<br/> | ||
* For more info on Code Analyzer, read our [documentation](https://forcedotcom.github.io/sfdx-scanner). | ||
* `run-arguments` (Default value: `'--normalize-severity'`) | ||
* <b>Specifies arguments passed to the specified `run-command` value.</b><br/> | ||
The arguments provided must include `--normalize-severity`.<br/> | ||
To control the output file included in the uploaded artifact, specify an output file name with the `--outfile` argument.<br/> | ||
If an output file isn’t specified, results are written to GitHub workflow run logs and a | ||
*SalesforceCodeAnalyzerResults.json* file is included in the uploaded artifact. | ||
* For a full list of acceptable arguments, read the appropriate Command Reference: | ||
* [sf scanner run](https://forcedotcom.github.io/sfdx-scanner/en/v3.x/scanner-commands/run) | ||
* [sf scanner run dfa](https://forcedotcom.github.io/sfdx-scanner/en/v3.x/scanner-commands/dfa) | ||
* `results-artifact-name` (Default: `'code-analyzer-results'`) | ||
* <b>Specifies the name of the zip archive job artifact where the results output file is uploaded.</b> | ||
|
||
# Outputs | ||
* `exit-code` | ||
* The Salesforce Code Analyzer execution exit code. | ||
* `num-violations` | ||
* The total number of violations found. | ||
* `num-sev1-violations` | ||
* The number of normalized high-severity violations found. | ||
* `num-sev2-violations` | ||
* The number of normalized medium-severity violations found. | ||
* `num-sev3-violations` | ||
* The number of normalized low-severity violations found. | ||
|
||
This `run-code-analyzer` action will not exit your GitHub workflow when violations are found. Instead, we recommend adding a subsequent step to your workflow that uses these outputs to determine how your workflow should proceed. | ||
|
||
# Example Usage | ||
|
||
name: Salesforce Code Analyzer Workflow | ||
on: push | ||
jobs: | ||
salesforce-code-analyzer-workflow: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out files | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install the Salesforce CLI | ||
run: npm install -g @salesforce/cli@latest | ||
|
||
- name: Install the Salesforce Code Analyzer Plugin | ||
run: sf plugins install @salesforce/sfdx-scanner@latest | ||
|
||
- name: Run the Salesforce Code Analyzer | ||
id: run-code-analyzer | ||
uses: forcedotcom/run-code-analyzer@v1 | ||
with: | ||
run-command: run | ||
run-arguments: --normalize-severity --outfile results.html | ||
results-artifact-name: salesforce-code-analyzer-results | ||
|
||
- name: Check the outputs to determine whether to fail | ||
if: | | ||
steps.run-code-analyzer.outputs.exit-code > 0 || | ||
steps.run-code-analyzer.outputs.num-sev1-violations > 0 || | ||
steps.run-code-analyzer.outputs.num-violations > 10 | ||
run: exit 1 | ||
|
||
# Contributing | ||
To contribute to the `run-code-analzer` GitHub Action, see [CONTRIBUTING.md](https://github.com/forcedotcom/run-code-analyzer/blob/main/CONTRIBUTING.md). |
This file contains 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