Skip to content
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

Dynamic Fetch of File Types #48

Closed
wants to merge 3 commits into from
Closed

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Dec 19, 2023

PR Feedback: 👎

I created this PR to address this rule:

"There should be no hard-coded values or magic numbers in the code."

Description

This PR addresses the issue of hard-coded values in the fileTypesOptions array in the src/lib.ts file. Instead of hard-coding the values, we now fetch them dynamically from a new configuration file, src/fileTypesConfig.json.

Changes made:

  1. Created a new configuration file src/fileTypesConfig.json that stores the file types and their corresponding labels.
  2. Modified the src/lib.ts file to replace the hard-coded fileTypesOptions array with a function that reads the fileTypesConfig.json file and returns the file types and labels dynamically.

Summary of Changes

  • Created src/fileTypesConfig.json.
  • Modified src/lib.ts:
    • Imported the fs module to read the fileTypesConfig.json file.
    • Replaced the fileTypesOptions array with a function that fetches the file types and labels from fileTypesConfig.json.

This change ensures that we adhere to the best practice of not having hard-coded values in our code.

Copy link
Contributor Author

sweep-ai bot commented Dec 19, 2023

Rollback Files For Sweep

  • Rollback changes to src/fileTypesConfig.json
  • Rollback changes to src/fileTypesConfig.json
  • Rollback changes to src/lib.ts
  • Rollback changes to src/lib.ts

@sweep-ai sweep-ai bot added the sweep label Dec 19, 2023
Copy link
Contributor Author

sweep-ai bot commented Dec 19, 2023

Sandbox Executions

  • Running GitHub Actions for src/fileTypesConfig.json
Check src/fileTypesConfig.json with contents:

Ran GitHub Actions for affe2ed37ca534edfd6dded43b3ff667cea2de62:

  • Running GitHub Actions for src/lib.ts
Check src/lib.ts with contents:

Ran GitHub Actions for 942cdca769e31b7c6080e44d45dae0ea1485c076:

Copy link

changeset-bot bot commented Dec 19, 2023

⚠️ No Changeset found

Latest commit: 41adee9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor Author

sweep-ai bot commented Dec 19, 2023

The command:
Run bun run typecheck
yielded the following error:
##[error]Process completed with exit code 2.
Here are the logs:

$ tsc --noEmit
src/lib.ts(105,38): error TS7006: Parameter 'option' implicitly has an 'any' type.

Copy link
Contributor Author

sweep-ai bot commented Dec 19, 2023

🚀 Wrote Changes

Done.

@jellydn jellydn closed this Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant