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(cmd): Add vet Command to CLI Tool #253

Merged
merged 4 commits into from
Oct 7, 2024
Merged

Conversation

jshlbrd
Copy link
Collaborator

@jshlbrd jshlbrd commented Oct 6, 2024

Description

  • Adds substation vet to the CLI tool

Motivation and Context

This adds the features of the AWS Lambda validate application to the CLI tool, and follows the conventions of other CLI tool commands (mimicking the go tool). It provides more info on Substation errors than validate by printing the line with the error below the error message, like this:

vet.jsonnet:3 transform 324f1035-10a51b9a: object_target_key: missing required option

    {"type":"hash_sha256","settings":{"id":"324f1035-10a51b9a","object":{"source_key":"foo"}}}

The additional output can be ported to validate using the addition of the stringer on config.go.

How Has This Been Tested?

substation vet was integration tested for a variety of use cases:

  • Vetting individual files
  • Vetting directories
  • Vetting nested directories

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@jshlbrd jshlbrd marked this pull request as ready for review October 7, 2024 15:10
@jshlbrd jshlbrd requested a review from a team as a code owner October 7, 2024 15:10

switch filepath.Ext(arg) {
case ".jsonnet", ".libsonnet":
mem, err := buildFile(arg, extVars)
Copy link
Contributor

@shellcromancer shellcromancer Oct 7, 2024

Choose a reason for hiding this comment

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

Is this change meant to land after the open PR for substation build? I'd expect an error with the rename to compileFile since you're utilizing the return signature for that function with the config in memory vs the built config.json file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, this needs to be rebased.

cmd/substation/vet.go Outdated Show resolved Hide resolved
@jshlbrd jshlbrd requested a review from shellcromancer October 7, 2024 17:14
@jshlbrd jshlbrd merged commit 97fbc92 into main Oct 7, 2024
7 checks passed
@jshlbrd jshlbrd deleted the jshlbrd/feat/cmd-vet branch October 7, 2024 17:54
This was referenced Oct 7, 2024
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