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

feat: add numbers.range_step built-in function #6187

Merged
merged 9 commits into from Aug 30, 2023

Conversation

sspaink
Copy link
Contributor

@sspaink sspaink commented Aug 29, 2023

Why the changes in this PR are needed?

resolves: #6186

What are the changes in this PR?

Adds a built-in function to create an array that increments by a user provided step value.

Notes to assist PR review:

  • Decided to restrict the step number to only positive values to allow easy reuse of the existing code.
  • Wasn't sure what the numbering convention is for the test files, so I just started at 1.

@netlify
Copy link

netlify bot commented Aug 29, 2023

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 255f198
🔍 Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/64ee1a46dc0a660008ea1c00
😎 Deploy Preview https://deploy-preview-6187--openpolicyagent.netlify.app/docs/edge/policy-reference
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. Nice first contribution!

Just a comment on the tests, but nothing major.

Copy link
Contributor

@johanfylling johanfylling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @sspaink! 😃
Just a few questions and comments.

ast/builtins.go Outdated Show resolved Hide resolved
ast/builtins.go Outdated Show resolved Hide resolved
topdown/numbers.go Outdated Show resolved Hide resolved
topdown/numbers.go Outdated Show resolved Hide resolved
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Copy link
Contributor

@johanfylling johanfylling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! 👍
Thanks again for the contribution @sspaink 😃

@johanfylling johanfylling merged commit c28eaf7 into open-policy-agent:main Aug 30, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a function similar to numbers.range that also accepts an increment
3 participants