Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kindermax
Copy link
Collaborator

@kindermax kindermax commented Apr 29, 2025

  • "x-" prefixed top level keywords are now supported. This allows alias this data in env
  • env can now alias "x-" prefixed maps which will be merged with "env"
  • improve docs - sidebar now has better nesting
  • improve docs - add conditional "init" explanation
  • add bats and unit tests

Summary by Sourcery

Add support for top-level custom keywords starting with "x-" and improve YAML aliasing for environment variables

New Features:

  • Support for top-level custom keywords prefixed with 'x-'
  • Add YAML alias support for environment variables

Enhancements:

  • Improve documentation structure and content
  • Add validation for top-level keywords in config

Documentation:

  • Update sidebar structure
  • Add detailed explanation of conditional init
  • Update changelog with new features

Tests:

  • Add bats and unit tests for new features
  • Add tests for env aliasing and keyword validation

@sourcery-ai
Copy link

sourcery-ai bot commented Apr 29, 2025

Reviewer's Guide

This pull request introduces support for custom top-level configuration keys prefixed with x- and enables YAML aliasing for env blocks. Config parsing was updated to allow x- prefixed keys, and the env unmarshalling logic now handles the YAML merge key (<<:) to incorporate aliased maps. Documentation and tests were added for the new features.

File-Level Changes

Change Details Files
Added support for x- prefixed top-level keywords and validation for unknown keywords.
  • Modified config unmarshalling to allow top-level keys starting with x-.
  • Added validation to reject unknown top-level keywords not starting with x-.
  • Added unit test for invalid keyword detection.
config/config/config.go
config/config/config_test.go
Enabled YAML merge key (<<:) support for merging aliased maps into env blocks.
  • Updated Envs unmarshalling to detect the YAML merge key (!!merge).
  • Implemented logic to recursively unmarshal and merge aliased environment maps.
  • Added unit tests for env merging.
  • Added BATS tests for global and command-level env merging with aliases.
config/config/env.go
config/config/config_test.go
tests/global_env.bats
tests/command_env.bats
tests/global_env/lets.aliased-env.yaml
tests/command_env/lets.aliased-env.yaml
Improved documentation structure and content.
  • Refactored sidebars.js for better nesting.
  • Added documentation for env aliasing.
  • Added documentation explaining a pattern for conditional init execution.
  • Updated changelog.
docs/sidebars.js
docs/docs/config.md
docs/docs/best_practices.md
docs/docs/changelog.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @kindermax - I've reviewed your changes - here's some feedback:

  • Consider splitting the documentation refactoring (sidebar structure, config table of contents) into a separate PR from the x- keyword and env aliasing feature.
Here's what I looked at during the review
  • 🟡 General issues: 9 issues found
  • 🟢 Security: all looks good
  • 🟡 Testing: 2 issues found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@lets-cli lets-cli deleted a comment from sourcery-ai bot Apr 29, 2025
@lets-cli lets-cli deleted a comment from sourcery-ai bot Apr 29, 2025
@lets-cli lets-cli deleted a comment from sourcery-ai bot Apr 29, 2025
@lets-cli lets-cli deleted a comment from sourcery-ai bot Apr 29, 2025
@lets-cli lets-cli deleted a comment from sourcery-ai bot Apr 29, 2025
@lets-cli lets-cli deleted a comment from sourcery-ai bot Apr 29, 2025
@lets-cli lets-cli deleted a comment from sourcery-ai bot Apr 29, 2025
@lets-cli lets-cli deleted a comment from sourcery-ai bot Apr 29, 2025
@lets-cli lets-cli deleted a comment from sourcery-ai bot Apr 29, 2025
* "x-" prefixed top level keywords are now supported. This allows alias this data in env
* env can now alias "x-" prefixed maps which will be merged with "env"
* improve docs - sidebar now has better nesting
* improve docs - add conditional "init" explanation
* add bats and unit tests
@kindermax kindermax force-pushed the support-top-level-custom-keywords-starting-with-x branch from 6e2204d to 8501169 Compare April 29, 2025 18:34
@lets-cli lets-cli deleted a comment from sourcery-ai bot Apr 29, 2025
@kindermax kindermax merged commit 168f46e into master Apr 29, 2025
4 checks passed
@kindermax kindermax deleted the support-top-level-custom-keywords-starting-with-x branch April 29, 2025 18:39
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.

2 participants