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

Replace hard-coded values in test cases with constants #2922

Closed
wants to merge 1 commit into from

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Jan 4, 2024

PR Feedback (click)

  • 👍 Sweep Did Well
  • 👎 Sweep Needs Improvement

I created this PR to address this rule:

"Avoid using magic numbers or hard-coded values in the code."

Description

This PR addresses the issue of hard-coded values in the test cases of the file "builtin_test.ts" in the "squiggle-lang" package. The hard-coded values were used in the comparison of arrays and this violated the rule of avoiding magic numbers or hard-coded values in the code.

To fix this issue, the hard-coded values have been replaced with variables or constants that have meaningful names. This makes the code more readable and maintainable.

Summary of Changes

  • Defined constants for the arrays that are used in the test cases at the top of the "builtin_test.ts" file.
  • Replaced the hard-coded array [1,2,3,5] in line 25 with the constant ARRAY_1235.
  • Replaced the hard-coded array [1,2,3] in line 26 with the constant ARRAY_123 and the hard-coded array [1,2,3,5] with the constant ARRAY_1235.
  • Replaced the hard-coded array [1,2,3,8] in line 27 with the constant ARRAY_1238 and the hard-coded array [1,2,3,5] with the constant ARRAY_1235.
  • Ensured that the test cases still pass after these modifications.

Please review the changes and let me know if any further modifications are required.

@sweep-ai sweep-ai bot requested review from OAGr and berekuk as code owners January 4, 2024 04:50
Copy link

vercel bot commented Jan 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quri-hub ✅ Ready (Inspect) Visit Preview Jan 4, 2024 5:06am
quri-ui ✅ Ready (Inspect) Visit Preview Jan 4, 2024 5:06am
squiggle-components ✅ Ready (Inspect) Visit Preview Jan 4, 2024 5:06am
squiggle-website ✅ Ready (Inspect) Visit Preview Jan 4, 2024 5:06am

Copy link
Contributor Author

sweep-ai bot commented Jan 4, 2024

Rollback Files For Sweep

  • Rollback changes to packages/squiggle-lang/tests/library/builtin_test.ts
  • Rollback changes to packages/squiggle-lang/tests/library/builtin_test.ts

@sweep-ai sweep-ai bot assigned OAGr Jan 4, 2024
@sweep-ai sweep-ai bot added the sweep label Jan 4, 2024
Copy link

changeset-bot bot commented Jan 4, 2024

⚠️ No Changeset found

Latest commit: 64772b0

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants