codeflash-internal/lefthook.yml

15 lines
479 B
YAML
Raw Normal View History

add secret scanner and monorepo hook (#1201) ### **User description** ### To Test this PR## 1. Clone and switch to the branch and Run `npm install` 2. Fork into a new branch to avoid pushing to this open PR 3. Add a file anywhere like test_secret.py and below code ``` def test_function(): # This is a fake API key for testing purposes api_key = "12345-ABCDE-67890-FGHIJ" print("Testing secret detection.") ```` 4. Add and try commiting the changes ### **User description** closes # https://linear.app/codeflash-ai/issue/CF-442/implement-a-secrets-scanning-solution-pre-commit-on-pr-deployments ___ ### **PR Type** enhancement, configuration changes ___ ### **Description** - Added Secretlint configuration to scan for secrets using recommended rules. - Introduced a shell script to run Ruff linting for Python projects. - Updated README with setup instructions and prerequisites for Node.js, npm, Python, and Mamba. - Configured Lefthook for pre-commit hooks to perform secret scanning and code linting. - Created `package.json` with scripts for Lefthook installation and Secretlint execution, and added relevant development dependencies. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Configuration changes</strong></td><td><table> <tr> <td> <details> <summary><strong>secretlint.config.js</strong><dd><code>Add Secretlint configuration with recommended rules</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> secretlint.config.js <li>Added configuration for Secretlint.<br> <li> Included a rule preset for recommended secret scanning.<br> </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash/pull/1201/files#diff-134b2fd8c53958449a6b2a9f828d28149ffa192f0864afa76e82aa68a9c6cc20">+7/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>lefthook.yml</strong><dd><code>Configure Lefthook for pre-commit secret and code linting</code></dd></summary> <hr> lefthook.yml <li>Added Lefthook configuration for pre-commit hooks.<br> <li> Configured secret scanning, Python linting, and JS linting commands.<br> </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash/pull/1201/files#diff-ad6a01e589b8b1b214ca310dbb8d2e4314f6c612b921050c73c97455de43884d">+20/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Add package.json with scripts and dev dependencies</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> package.json <li>Added project metadata and scripts for Lefthook and Secretlint.<br> <li> Included development dependencies for Lefthook, Secretlint, and <br>ESLint.<br> </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash/pull/1201/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519">+23/-0</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>run_ruff.sh</strong><dd><code>Add shell script for Ruff linting in Python projects</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> run_ruff.sh <li>Added a shell script to run Ruff linting.<br> <li> Configured environment activation and linting command.<br> </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash/pull/1201/files#diff-08d9b9bfc882fa06fe0a67bf49f0512f2ea2202f99286e1d826bb94d6af5e333">+12/-0</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Documentation</strong></td><td><table> <tr> <td> <details> <summary><strong>README.md</strong><dd><code>Update README with project setup and prerequisites</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> README.md <li>Updated project setup instructions.<br> <li> Added prerequisites for Node.js, npm, Python, and Mamba.<br> </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash/pull/1201/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5">+8/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull request to receive relevant information ___ ### **PR Type** Enhancement, Configuration changes ___ ### **Description** - Added Secretlint configuration to scan for secrets using recommended rules. - Introduced a shell script to run Ruff linting for Python projects. - Updated README with setup instructions and prerequisites for Node.js, npm, Python, and Mamba. - Configured Lefthook for pre-commit hooks to perform secret scanning and code linting. - Created `package.json` with scripts for Lefthook installation and Secretlint execution, and added relevant development dependencies. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Configuration changes</strong></td><td><table> <tr> <td> <details> <summary><strong>secretlint.config.js</strong><dd><code>Add Secretlint configuration for secret scanning</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> secretlint.config.js <li>Added Secretlint configuration file.<br> <li> Configured with recommended rules for secret scanning.<br> </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash/pull/1201/files#diff-134b2fd8c53958449a6b2a9f828d28149ffa192f0864afa76e82aa68a9c6cc20">+7/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>lefthook.yml</strong><dd><code>Configure Lefthook for pre-commit secret scanning and linting</code></dd></summary> <hr> lefthook.yml <li>Configured Lefthook for pre-commit hooks.<br> <li> Added commands for secret scanning and code linting.<br> </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash/pull/1201/files#diff-ad6a01e589b8b1b214ca310dbb8d2e4314f6c612b921050c73c97455de43884d">+20/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Add package.json with scripts and dependencies</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> package.json <li>Created <code>package.json</code> for the monorepo.<br> <li> Added scripts for Lefthook and Secretlint.<br> <li> Included development dependencies.<br> </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash/pull/1201/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519">+23/-0</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>run_ruff.sh</strong><dd><code>Introduce shell script for Ruff linting in Python</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> run_ruff.sh <li>Created a shell script to run Ruff linting.<br> <li> Script navigates to the Python project directory.<br> <li> Activates Mamba environment for linting.<br> </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash/pull/1201/files#diff-08d9b9bfc882fa06fe0a67bf49f0512f2ea2202f99286e1d826bb94d6af5e333">+12/-0</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Documentation</strong></td><td><table> <tr> <td> <details> <summary><strong>README.md</strong><dd><code>Update README with setup instructions and prerequisites</code>&nbsp; &nbsp; </dd></summary> <hr> README.md <li>Added project setup instructions.<br> <li> Listed prerequisites for Node.js, npm, Python, and Mamba.<br> </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash/pull/1201/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5">+8/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull request to receive relevant information
2024-11-09 14:23:39 +00:00
pre-commit:
parallel: true
commands:
secret-scan:
runner: "node"
glob: "*"
exclude: "node_modules/**|venv/**|.venv/**|__pycache__/**|dist/**|build/**"
command: "./node_modules/.bin/secretlint {staged_files} --maskSecrets --config ./secretlint.config.js"
pricing dedupe and flow improve (#1511) ### **PR Type** - Enhancement ___ ### **Description** - Update subscription checkout and cancellation logic - Add subscription limits and usage reset utilities - Enhance login, onboarding, and billing redirects - Upgrade dependency versions and lint configurations ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>20 files</summary><table> <tr> <td><strong>actions.ts</strong><dd><code>Refactor checkout session and cancellation functions</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-483bd280b775abd99ae9bbbbcbee9cdcd7407a5c8f09e97591143ea7a460a349">+23/-76</a>&nbsp; </td> </tr> <tr> <td><strong>subscription-functions.ts</strong><dd><code>Add subscription limits and monthly reset utilities</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-9fc439c25400b7ac049770509373f3e17ec84f0ba471fda2814bd37e4155b01b">+95/-6</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>subscription-management.ts</strong><dd><code>Integrate common subscription functions in endpoints</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-a8e2aca1f0313219f56d75c5d57f36d869fada2292457444f50843b304c26c99">+15/-24</a>&nbsp; </td> </tr> <tr> <td><strong>billing-view.tsx</strong><dd><code>Improve billing view UI and period handling</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-4b7dc7632b66abfc90fcb72aaca8222a6f72b2cd65386f5cdf3d6affec187565">+22/-8</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>page.tsx</strong><dd><code>Add error handling and fallback subscription data</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-86ac324c6a48fe59d742a236c9abad3998b7c571534ba8b4a757a89f5ad3ef83">+34/-18</a>&nbsp; </td> </tr> <tr> <td><strong>page.tsx</strong><dd><code>Enhance login redirect with safe return URL check</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-51fffa5e02e56eafab1bd3288c83046bb460d6f72cd89aee2f2fb106f19250e1">+29/-1</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>page.tsx</strong><dd><code>Improve checkout flow with logging and Sentry tracking</code>&nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-ab1265c18dc76b25db6970b8b1943cdbd6d9a36092a6091cdf705a3e9fc0b42a">+22/-7</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>SubmitFirstOnboardingPage.tsx</strong><dd><code>Implement cookie-based redirect after onboarding</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-f7408066207ec9b618596437140aa986df7b733d84a04897b9fc1b48e9691772">+19/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>prisma-client.ts</strong><dd><code>Introduce singleton Prisma client initialization</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-2961161048a21c0e00e92d799ccbe21870c5638af2aab0670c963c3d5dd929b0">+14/-16</a>&nbsp; </td> </tr> <tr> <td><strong>stripe-client.ts</strong><dd><code>Add browser check for Stripe client initialization</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-688ec9d856f21b99370442e1c056bcdca697f39f0773d0ed551ad3402d385f2e">+12/-5</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>is-github-app-installed.ts</strong><dd><code>Update import paths with explicit file extensions</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-4b97bd2b461108930999b4af7e47d4763ad1b9490f7352130109c39f5abf4561">+3/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>package.json</strong><dd><code>Modify build script and update dependency versions</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-4edec169b0f8d3312edaf35b5cc8521fe1edfa163ce174f60eff51906896601f">+5/-6</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>package.json</strong><dd><code>Upgrade dependency and dev tool versions</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-b0d32af9c2caaba1377ec3e924eb553105cdc86e244018ffc6a866c530523599">+7/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>package.json</strong><dd><code>Refine lint commands and dependency configurations</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+2/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>.eslintrc.mjs</strong><dd><code>Simplify ESLint settings for cf-api</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-64f33493724c98b62fa6fc15a3e6150006f9e276eec35982f0121c93d4615858">+14/-28</a>&nbsp; </td> </tr> <tr> <td><strong>.eslintrc.mjs</strong><dd><code>Revise ESLint configuration for webapp</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-3e792fa9bf87a9f417a08617cdcd8f5465c92cca62190490bbeb4a76ed3775fd">+26/-15</a>&nbsp; </td> </tr> <tr> <td><strong>.eslintrc.json</strong><dd><code>Adjust ESLint rules and ignore patterns</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-b44cde4a55654414f4e45c08668a213ddf35250ea82ffef282107956af25efcb">+24/-2</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>eslint.config.mjs</strong><dd><code>Add new ESLint configuration for common package</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-24b160f5da434c3e13caaa30e6a33be7a7950af40ec0fcac07cdfd724036dccd">+29/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>lefthook.yml</strong><dd><code>Comment out js-lint hook in lefthook configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-ad6a01e589b8b1b214ca310dbb8d2e4314f6c612b921050c73c97455de43884d">+5/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>tsconfig.json</strong><dd><code>Include express types and refine TS settings</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-3532a852c82c88daeed6b57a35cd52c4a2589c909edc756613d67e280ab9b23e">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Additional files</strong></td><td><details><summary>8 files</summary><table> <tr> <td><strong>.eslintignore</strong></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-285326f37b4ef7a8e43dc3fd17135ad3a3a51a85a9d2ddc5bdd234ffbf3ffada">+9/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>package-lock.json</strong></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-75446c74353509ca0232d6a1350aef075ced8f72bd568e9bafa09cf255683142">+231/-213</a></td> </tr> <tr> <td><strong>subscription-utils.ts</strong></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-846af69dc1c830de7e6d0c1f73a01e75d60d3e3788b0b60d907d8a161140c679">+0/-122</a>&nbsp; </td> </tr> <tr> <td><strong>.eslintignore</strong></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-9c369a46ac4f2c69b2e6ee4bc3d38a9837f0ec0d0ab51002f5b8220c4644fd4d">+12/-1</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>next.config.mjs</strong></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-457975a67fc5d4317fca780879ee23a0e6bae3b3ac41a8d69b8e3dad006d0bb6">+1/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>package-lock.json</strong></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-0214c85d1717ad8b736e0296bb8cbf50db2aed068f31316d3c39904824a14f8e">+797/-1850</a></td> </tr> <tr> <td><strong>.eslintignore</strong></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-fdc1690e7d0eea11a33263e0c96b5f1c506946809567531f9ed7ce764b37e802">+11/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>package-lock.json</strong></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1511/files#diff-54c17cef859f033fc84a59da2e977235ebc494943710c25d132e310ec500c5ef">+2361/-108</a></td> </tr> </table></details></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-03-11 23:29:20 +00:00
# js-lint:
# runner: "node"
# glob: "*.js"
# exclude: "node_modules/**|build/**|dist/**"
# command: "./node_modules/.bin/eslint {staged_files} --ignore-path .gitignore"