You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cycode’s pre-commit hook can be set up within your local repository so that the Cycode CLI application will identify any issues with your code automatically before you commit it to your codebase.
217
+
Cycode's pre-commit and pre-push hooks can be set up within your local repository so that the Cycode CLI application will identify any issues with your code automatically before you commit or push it to your codebase.
217
218
218
219
> [!NOTE]
219
-
> pre-commit hook is not available for IaC scans.
220
+
> pre-commit and pre-push hooks are not available for IaC scans.
220
221
221
222
Perform the following steps to install the pre-commit hook:
222
223
224
+
### Installing Pre-Commit Hook
225
+
223
226
1. Install the pre-commit framework (Python 3.9 or higher must be installed):
224
227
225
228
```bash
@@ -233,29 +236,25 @@ Perform the following steps to install the pre-commit hook:
4. Modify the created file for your specific needs. Use hook ID `cycode` to enable scan for Secrets. Use hook ID `cycode-sca` to enable SCA scan. Use hook ID `cycode-sast` to enable SAST scan. If you want to enable all scanning types, use this configuration:
> Pre-push hooks trigger on `git push` command and scan only the commits about to be pushed.
310
+
281
311
# Cycode CLI Commands
282
312
283
313
The following are the options and commands available with the Cycode CLI application:
@@ -786,6 +816,107 @@ After installing the pre-commit hook, you may occasionally wish to skip scanning
786
816
SKIP=cycode git commit -m <your commit message>`
787
817
```
788
818
819
+
### Pre-Push Scan
820
+
821
+
A pre-push scan automatically identifies any issues before you push changes to the remote repository. This hook runs on the client side and scans only the commits that are about to be pushed, making it efficient for catching issues before they reach the remote repository.
822
+
823
+
> [!NOTE]
824
+
> Pre-push hook is not available for IaC scans.
825
+
826
+
The pre-push hook integrates with the pre-commit framework and can be configured to run before any `git push` operation.
827
+
828
+
#### Installing Pre-Push Hook
829
+
830
+
To set up the pre-push hook using the pre-commit framework:
831
+
832
+
1. Install the pre-commit framework (if not already installed):
833
+
834
+
```bash
835
+
pip3 install pre-commit
836
+
```
837
+
838
+
2. Create or update your `.pre-commit-config.yaml` file to include the pre-push hooks:
This smart detection ensures the pre-push hook works correctly regardless of whether your repository uses `main`, `master`, `develop`, or any other default branch name.
902
+
903
+
#### Skipping Pre-Push Scans
904
+
905
+
To skip the pre-push scan for a specific push operation, use:
906
+
907
+
```bash
908
+
SKIP=cycode-pre-push git push
909
+
```
910
+
911
+
Or to skip all pre-push hooks:
912
+
913
+
```bash
914
+
git push --no-verify
915
+
```
916
+
917
+
> [!TIP]
918
+
> The pre-push hook is triggered on `git push` command and scans only the commits that are about to be pushed, making it more efficient than scanning the entire repository.
919
+
789
920
## Scan Results
790
921
791
922
Each scan will complete with a message stating if any issues were found or not.
0 commit comments