-
Notifications
You must be signed in to change notification settings - Fork 125
typoes fix in validator/validate.go and validate_test.go #712
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
Conversation
Yay, your first pull request! 👍 A contributor will be by to give feedback soon. In the meantime, you can find updates in the #github-notifications channel in the community Slack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Exar04, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request addresses a few minor issues in the validator
package. Specifically, it corrects a typo in validate_test.go
, updates the file path for the design schema in validate.go
, and removes an unused import and a print statement in validate_test.go
. The changes aim to improve the accuracy and maintainability of the validator component.
Highlights
- Typo Fix: Corrects the typo "Dployment" to "Deployment" in
validator/validate_test.go
to ensure the test case accurately reflects the intended data type. - Schema Path Update: Updates the schema file path in
validator/validate.go
fromschemas/constructs/v1beta1/designs.json
toschemas/constructs/v1beta1/design/design.json
to point to the correct schema file. - Code Cleanup: Removes the unused
fmt
import and a debuggingfmt.Println
statement fromvalidator/validate_test.go
to improve code cleanliness.
Changelog
- validator/validate.go
- Updated schema file path from
schemas/constructs/v1beta1/designs.json
toschemas/constructs/v1beta1/design/design.json
(lines 33 and 35).
- Updated schema file path from
- validator/validate_test.go
- Removed unused
fmt
import (line 4). - Corrected typo in
CatalogDataType
from "Dployment" to "Deployment" (line 41). - Removed debugging
fmt.Println
statement (line 75). - Corrected typo in test name from "validaion" to "validation" (line 67).
- Removed unused
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
A schema's path,
Must be correct, or all's lost.
Tests catch the change.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This PR fixes typos in validator/validate.go
and validate_test.go
. The changes include correcting a typo in a test case and updating the path to the design schema. The code changes are straightforward and address the identified issues.
Summary of Findings
- Typo correction: The PR corrects a typo in the
CatalogDataType
field within the test case for catalog data validation. This ensures the test case accurately reflects the expected data type. - Schema path update: The PR updates the path to the design schema in
validator/validate.go
. This ensures the validator uses the correct schema file for design validation. - Unnecessary import: The PR removes the unused
fmt
import fromvalidator/validate_test.go
, which helps to keep the code clean and reduces unnecessary dependencies. - Typo correction in test name: The PR corrects a typo in the test name from
validaion
tovalidation
invalidator/validate_test.go
. - Unnecessary print statement: The PR removes the unnecessary
fmt.Println(err)
statement fromvalidator/validate_test.go
.
Merge Readiness
The pull request addresses the identified typos and updates the schema path. The changes are straightforward and improve the code's correctness and clarity. I am unable to directly approve the pull request, and users should have others review and approve this code before merging. I recommend merging this pull request after addressing the review comments.
file, err := schemas.Schemas.Open("schemas/constructs/v1beta1/design/design.json") | ||
if err != nil { | ||
return utils.ErrReadFile(err, "schemas/constructs/v1beta1/designs.json") | ||
return utils.ErrReadFile(err, "schemas/constructs/v1beta1/design/design.json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path to the schema file has been updated. Ensure that the new path schemas/constructs/v1beta1/design/design.json
is correct and that the file exists at the specified location. This is a high
severity issue because an incorrect path will cause the validator to fail.
file, err := schemas.Schemas.Open("schemas/constructs/v1beta1/design/design.json") | |
if err != nil { | |
return utils.ErrReadFile(err, "schemas/constructs/v1beta1/designs.json") | |
return utils.ErrReadFile(err, "schemas/constructs/v1beta1/design/design.json") | |
file, err := schemas.Schemas.Open("schemas/constructs/v1beta1/design/design.json") | |
if err != nil { | |
return utils.ErrReadFile(err, "schemas/constructs/v1beta1/design/design.json") | |
} |
Type: v1alpha1.CatalogDataType("Deployment"), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typo in CatalogDataType("Dployment")
has been corrected to CatalogDataType("Deployment")
. This is a high
severity issue because the typo could cause the test to fail unexpectedly or pass incorrectly.
Type: v1alpha1.CatalogDataType("Deployment"), | |
}, | |
Type: v1alpha1.CatalogDataType("Deployment"), |
t.Run("validation", func(_t *testing.T) { | ||
schema, err := GetSchemaFor(test.Path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typo in the test name validaion
has been corrected to validation
. This is a medium
severity issue because it improves the readability and maintainability of the test code.
t.Run("validation", func(_t *testing.T) { | |
schema, err := GetSchemaFor(test.Path) | |
t.Run("validation", func(_t *testing.T) { |
} | ||
|
||
for _, test := range tests { | ||
t.Run("validaion", func(_t *testing.T) { | ||
t.Run("validation", func(_t *testing.T) { | ||
schema, err := GetSchemaFor(test.Path) | ||
if err != nil { | ||
t.Errorf("%v", err) | ||
|
||
} | ||
|
||
err = Validate(schema, test.Resource) | ||
fmt.Println(err) | ||
if test.ShouldPass && err != nil { | ||
t.Errorf("test failed for %s, got %s, want %t, error: %v", test.Path, "false", test.ShouldPass, err) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
This PR fixes #576
Notes for Reviewers
Signed commits