Skip to content

Feat/pre commit #1616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: local
hooks:
- id: gateway-black
name: "[gateway] Run black"
language: system
entry: "./.pre-commit-scripts.sh gateway_black"
- id: gateway-lint
name: "[gateway] Run lint"
language: system
entry: "./.pre-commit-scripts.sh geteway_lint"
- repo: https://github.com/ibm/detect-secrets
rev: 0.13.1+ibm.62.dss
hooks:
- id: detect-secrets # pragma: whitelist secret
args: [--baseline, .secrets.baseline, --use-all-plugins]
36 changes: 36 additions & 0 deletions .pre-commit-scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

set -e

cd "$(dirname "$0")"

run_gateway_black() {
echo "➡️ Running black..."
cd gateway
source venv/bin/activate
tox -eblack
cd - > /dev/null
}

run_gateway_lint() {
echo "➡️ Running lint..."
cd gateway
pwd
source venv/bin/activate
tox -elint
cd - > /dev/null
}

main() {
case "$1" in
gateway_black) run_gateway_black ;;
geteway_lint) run_gateway_lint ;;
*)
echo "Unknown command: $1"
echo "Usage: $0 {gateway_black|geteway_lint|detect_secrets}"
exit 1
;;
esac
}

main "$@"
226 changes: 226 additions & 0 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
{
"exclude": {
"files": "^.secrets.baseline$",
"lines": null
},
"generated_at": "2025-04-07T11:22:45Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
},
{
"name": "ArtifactoryDetector"
},
{
"name": "AzureStorageKeyDetector"
},
{
"base64_limit": 4.5,
"name": "Base64HighEntropyString"
},
{
"name": "BasicAuthDetector"
},
{
"name": "BoxDetector"
},
{
"name": "CloudantDetector"
},
{
"ghe_instance": "github.ibm.com",
"name": "GheDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"hex_limit": 3,
"name": "HexHighEntropyString"
},
{
"name": "IbmCloudIamDetector"
},
{
"name": "IbmCosHmacDetector"
},
{
"name": "JwtTokenDetector"
},
{
"keyword_exclude": null,
"name": "KeywordDetector"
},
{
"name": "MailchimpDetector"
},
{
"name": "NpmDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "SlackDetector"
},
{
"name": "SoftlayerDetector"
},
{
"name": "SquareOAuthDetector"
},
{
"name": "StripeDetector"
},
{
"name": "TwilioKeyDetector"
}
],
"results": {
"charts/qiskit-serverless/charts/gateway/values.yaml": [
{
"hashed_secret": "998c8abc0a1db80b888876d95d668e1dcac06d07",
"is_secret": false,
"is_verified": false,
"line_number": 69,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "ea72f7010dd797a00526144c395e8d506a0d843a",
"is_secret": false,
"is_verified": false,
"line_number": 75,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "7c6a61c68ef8b9b6b061b28c348bc1ed7921cb53",
"is_secret": false,
"is_verified": false,
"line_number": 88,
"type": "Secret Keyword",
"verified_result": null
}
],
"charts/qiskit-serverless/values.yaml": [
{
"hashed_secret": "fc4b79ff2005c1bfacead828184f0c8aad8fd860",
"is_secret": false,
"is_verified": false,
"line_number": 85,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "998c8abc0a1db80b888876d95d668e1dcac06d07",
"is_secret": false,
"is_verified": false,
"line_number": 87,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "7c6a61c68ef8b9b6b061b28c348bc1ed7921cb53",
"is_secret": false,
"is_verified": false,
"line_number": 106,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "40c95d45403f6e021f6ef85f7cb145367ce68c3f",
"is_secret": false,
"is_verified": false,
"line_number": 132,
"type": "Secret Keyword",
"verified_result": null
}
],
"docker-compose-dev.yaml": [
{
"hashed_secret": "40c95d45403f6e021f6ef85f7cb145367ce68c3f",
"is_secret": false,
"is_verified": false,
"line_number": 76,
"type": "Secret Keyword",
"verified_result": null
}
],
"docker-compose.yaml": [
{
"hashed_secret": "40c95d45403f6e021f6ef85f7cb145367ce68c3f",
"is_secret": false,
"is_verified": false,
"line_number": 64,
"type": "Secret Keyword",
"verified_result": null
}
],
"gateway/tests/api/authentication/custom_token/test_ibm_cloud.py": [
{
"hashed_secret": "1ead2e757ef1634753dae139c932a938d48f94c5",
"is_secret": false,
"is_verified": false,
"line_number": 100,
"type": "Hex High Entropy String",
"verified_result": null
}
],
"gateway/tests/fixtures/acl_fixtures.json": [
{
"hashed_secret": "b6b26b85a265de5e618815f1cf0f3363e76efe4f",
"is_secret": false,
"is_verified": false,
"line_number": 39,
"type": "Secret Keyword",
"verified_result": null
}
],
"gateway/tests/fixtures/catalog_fixtures.json": [
{
"hashed_secret": "b6b26b85a265de5e618815f1cf0f3363e76efe4f",
"is_secret": false,
"is_verified": false,
"line_number": 21,
"type": "Secret Keyword",
"verified_result": null
}
],
"gateway/tests/fixtures/files_fixtures.json": [
{
"hashed_secret": "b6b26b85a265de5e618815f1cf0f3363e76efe4f",
"is_secret": false,
"is_verified": false,
"line_number": 21,
"type": "Secret Keyword",
"verified_result": null
}
],
"gateway/tests/fixtures/fixtures.json": [
{
"hashed_secret": "b6b26b85a265de5e618815f1cf0f3363e76efe4f",
"is_secret": false,
"is_verified": false,
"line_number": 49,
"type": "Secret Keyword",
"verified_result": null
}
],
"gateway/tests/fixtures/schedule_fixtures.json": [
{
"hashed_secret": "b6b26b85a265de5e618815f1cf0f3363e76efe4f",
"is_secret": false,
"is_verified": false,
"line_number": 38,
"type": "Secret Keyword",
"verified_result": null
}
]
},
"version": "0.13.1+ibm.62.dss",
"word_list": {
"file": null,
"hash": null
}
}