-
Notifications
You must be signed in to change notification settings - Fork 5
aadarsh-st/SK-2495 replace hardcode values with constants #277
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
aadarsh-st/SK-2495 replace hardcode values with constants #277
Conversation
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the codebase by replacing hardcoded string values with named constants to improve maintainability and reduce magic strings. The changes introduce new constant objects (SDK, SKYFLOW, CONFIG, HTTP_STATUS_CODE, CONTENT_TYPE, HTTP_HEADER, DETECT_STATUS, FILE_EXTENSION, FILE_FORMAT_TYPE, FILE_PROCESSING, ENCODING_TYPE, JWT, API_KEY, URL_PROTOCOL, BOOLEAN_STRING) and updates all references throughout the codebase to use these constants.
Changes:
- Introduced constant objects for SDK metadata, Skyflow IDs, configuration keys, HTTP-related values, file processing, encoding types, JWT settings, and other string literals
- Updated all source files to reference the new constants instead of hardcoded strings
- Added ESLint configuration to enforce usage of constants over magic strings
- Disabled camelCase linting for generated code and specific files using snake_case variables
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/index.ts | Defines new constant objects (SDK, SKYFLOW, CONFIG, HTTP_STATUS_CODE, CONTENT_TYPE, HTTP_HEADER, DETECT_STATUS, FILE_EXTENSION, FILE_FORMAT_TYPE, FILE_PROCESSING, ENCODING_TYPE, JWT, API_KEY, URL_PROTOCOL, BOOLEAN_STRING) to replace hardcoded values |
| src/vault/skyflow/index.ts | Replaces hardcoded config-related strings with CONFIG constant references |
| src/vault/controller/vault/index.ts | Replaces hardcoded SDK, Skyflow ID, content type, and encoding strings with constant references |
| src/vault/controller/detect/index.ts | Replaces hardcoded file processing, encoding, and status strings with constant references |
| src/vault/controller/connections/index.ts | Replaces hardcoded SDK, Skyflow auth, content type, and request ID strings with constant references |
| src/vault/client/index.ts | Replaces hardcoded HTTP header, content type, boolean string, and status code values with constant references |
| src/utils/validations/index.ts | Replaces hardcoded Skyflow ID and config strings with constant references |
| src/utils/jwt-utils/index.ts | Adds ESLint disable comment for camelCase rule due to jwt_decode import |
| src/service-account/index.ts | Replaces hardcoded HTTP, content type, JWT, and encoding strings with constant references |
| test/vault/controller/vault.test.js | Updates mock to include new constant structures |
| test/vault/controller/detect.test.js | Updates mock and test assertions to use constants, refactors test setup with improved comments |
| test/vault/controller/connection.test.js | Replaces hardcoded constant references with new SDK and SKYFLOW constant structures |
| test/vault/utils/utils.test.js | Adds ESLint disable comment for camelCase rule due to jwt_decode import |
| test/vault/utils/jwt-utils/jwt.test.js | Adds ESLint disable comment for camelCase rule due to jwt_decode import |
| src/vault/model/options/deidentify-file/bleep-audio/index.ts | Adds ESLint disable comment for camelCase rule for generated code with snake_case properties |
| samples/vault-api/data-residency.ts | Adds ESLint disable comment for camelCase rule due to skyflow_id destructuring |
| package.json | Updates ESLint script to include TypeScript files and removes prettier from lint script |
| eslint.config.mjs | Adds new ESLint configuration with TypeScript support and rules for enforcing constants over magic strings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f1f5a65 to
b4ecf5a
Compare
No description provided.