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 Magic Numbers and Hard-Coded Values in simpleValue.ts #2831

Closed
wants to merge 6 commits into from

Conversation

sweep-ai[bot]
Copy link
Contributor

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

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 magic numbers and hard-coded values in the file "packages/squiggle-lang/src/value/simpleValue.ts". All such instances have been replaced with named constants to improve code readability and maintainability.

Summary of Changes

  • Replaced hard-coded strings "vType", "Lambda", "toString", and "paramenterString" with named constants in the function removeLambdas.
  • Replaced hard-coded strings "vtype" and "Dict" with named constants in the function simpleValueFromValue.
  • Replaced hard-coded strings "vType", "Calculator", "fn", "inputs", "autorun", "description", "title", and "sampleCount" with named constants in the function simpleValueFromValue.
  • Replaced hard-coded strings "vType", "Plot", "type", "title", "distributions", "name", "distribution", "xScale", "yScale", "showSummary", "fn", "points", "distXScale", "xDist", "yDist", "ids", and "relativeValues" with named constants in the function simpleValueFromValue.
  • Replaced hard-coded strings "vType", "TableChart", "data", "columns", "fn", and "name" with named constants in the function simpleValueFromValue.
  • Replaced hard-coded strings "vType", "Scale", "type", "tickFormat", and "title" with named constants in the function simpleValueFromValue.

All constants have been defined at the top of the file "packages/squiggle-lang/src/value/simpleValue.ts".

@sweep-ai sweep-ai bot requested review from OAGr and berekuk as code owners December 31, 2023 02:52
@sweep-ai sweep-ai bot assigned OAGr Dec 31, 2023
Copy link

vercel bot commented Dec 31, 2023

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

Name Status Preview Updated (UTC)
quri-hub ❌ Failed (Inspect) Dec 31, 2023 2:54am
squiggle-components ❌ Failed (Inspect) Dec 31, 2023 2:54am
squiggle-website ❌ Failed (Inspect) Dec 31, 2023 2:54am
1 Ignored Deployment
Name Status Preview Updated (UTC)
quri-ui ⬜️ Ignored (Inspect) Visit Preview Dec 31, 2023 2:54am

Copy link
Contributor Author

sweep-ai bot commented Dec 31, 2023

Rollback Files For Sweep

  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts
  • Rollback changes to packages/squiggle-lang/src/value/simpleValue.ts

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

sweep-ai bot commented Dec 31, 2023

Sandbox Executions

  • Running GitHub Actions for packages/squiggle-lang/src/value/simpleValue.ts
Check packages/squiggle-lang/src/value/simpleValue.ts with contents:

Ran GitHub Actions for 24db96e2f3866f688b24261ff0478227762435fe:

  • Running GitHub Actions for packages/squiggle-lang/src/value/simpleValue.ts
Check packages/squiggle-lang/src/value/simpleValue.ts with contents:

Ran GitHub Actions for 4aa381201c5386e434aa80e5cd0021899dbcedfe:

  • Running GitHub Actions for packages/squiggle-lang/src/value/simpleValue.ts
Check packages/squiggle-lang/src/value/simpleValue.ts with contents:

Ran GitHub Actions for 51e35cdf03efddbc55c807a9c4d883cdddbc8fb2:

  • Running GitHub Actions for packages/squiggle-lang/src/value/simpleValue.ts
Check packages/squiggle-lang/src/value/simpleValue.ts with contents:

Ran GitHub Actions for 464abb0dc1f0586383e6f975af46172a01e1663d:

  • Running GitHub Actions for packages/squiggle-lang/src/value/simpleValue.ts
Check packages/squiggle-lang/src/value/simpleValue.ts with contents:

Ran GitHub Actions for 21a9bd97fb4d44b059f77228fe38cfefa3cc9337:

  • Running GitHub Actions for packages/squiggle-lang/src/value/simpleValue.ts
Check packages/squiggle-lang/src/value/simpleValue.ts with contents:

Ran GitHub Actions for 44c99e4897d725e3ccf984f503b73a2debbafde8:

Copy link

changeset-bot bot commented Dec 31, 2023

⚠️ No Changeset found

Latest commit: 44c99e4

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.

1 participant