-
Notifications
You must be signed in to change notification settings - Fork 139
fix(app): fixes lint issues #738
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
base: master
Are you sure you want to change the base?
Conversation
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 @mohit-nagaraj, 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
Hello! Gemini here, providing a summary of this pull request to help everyone get up to speed quickly. This PR, titled "fix(app): fixes lint issues", aims to address several linting issues identified in the codebase. According to the description, it partially fixes issue #710. The changes primarily focus on improving error handling in specific areas and correcting logging format usage, as well as updating a dependency.
Highlights
- Improved Error Handling: Error checks have been added or corrected in
converter/tests/helm_test.go
forio.Copy
and ingenerators/github/url.go
foros.ReadFile
before subsequent operations. - Logging Format Correction: The logging call in
utils/component/generator.go
has been updated fromlogrus.Info
tologrus.Infof
to correctly format the log message with the provided error. - Dependency Update: The
go.sum
file has been updated to include entries forgithub.1485827954.workers.dev/meshery/schemas v0.8.22
, likely as a result of other changes or dependency resolution during linting fixes.
Changelog
- converter/tests/helm_test.go
- Added error check for
io.Copy
call on line 142.
- Added error check for
- generators/github/url.go
- Added an error check for
os.ReadFile
on line 58 before attempting to write the data.
- Added an error check for
- go.sum
- Added entries for
github.com/meshery/schemas v0.8.22
.
- Added entries for
- utils/component/generator.go
- Changed
logrus.Info
tologrus.Infof
on line 75 for proper error formatting.
- Changed
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.
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 pull request addresses several linting issues as described, specifically focusing on error handling and a minor logging format change. The changes implemented are correct and improve the robustness and clarity of the code in the affected areas. It's good to see these specific issues being tackled.
Summary of Findings
- Error Handling (
io.Copy
): Added error checking forio.Copy
in theextractManifestFromChart
test helper function (medium
severity). - Error Handling (Overwritten Error): Corrected an issue in
GetContent
where the error fromos.ReadFile
was being overwritten by the error fromw.Write
before being checked. This fix ensures proper error propagation (high
severity). - Logging Format: Updated
logrus.Info
tologrus.Infof
inIncludeComponentBasedOnGroup
for correct formatted logging of errors (low
severity - not commented on directly as per review settings). - Deprecated Package Usages: The PR description and the provided
golangci-lint
output indicate several usages of deprecated packages (oras
,nats
,opa
) that are not addressed in this PR. While outside the scope of the current changes, these should be addressed in follow-up PRs to fully resolve the reported lint issues.
Merge Readiness
The code changes in this pull request correctly address the specific error handling and logging issues they target. The fixes are well-implemented and improve the code quality in these areas. The PR description acknowledges that this is a partial fix for the overall linting problem, listing the remaining deprecated package issues. Based on the changes included in this PR, the code is in good shape to be merged. However, it is strongly recommended that follow-up pull requests are created to address the remaining deprecated package usages identified by the linter to fully resolve the linting debt. I am unable to approve the pull request; other reviewers should review and approve this code before merging.
@vishalvivekm could you suggest the next steps? shall i migrate few of the packges? |
edited: verifying with tests |
updating the nats based on this doc |
so the lints are in place, but the workflow will still fail because of the test cases which are failing |
just checked out why one of the testcase is failing, now we get only oci://registry-1.docker.io/bitnamicharts/consul:11.4.18 from the urls, so theres no direct https url to chart |
Bitnami (and many other Helm chart publishers) are moving from HTTP(S)-based chart repositories (e.g., https://charts.bitnami.com/bitnami/consul) to OCI-based registries (e.g., oci://registry-1.docker.io/bitnamicharts/consul:11.4.19). This is now the only way to get the latest charts, as confirmed in the Bitnami migration blog. |
package_test.go:37: error while generating components: Get "oci://registry-1.docker.io/bitnamicharts/consul:11.4.19": unsupported protocol scheme "oci" |
last test case which is failing for some reason its not able to locate these files i believe? should investigate this further |
I am not able to find any in this route path for file 'schemas/constructs/v1beta1/designs.json' anyone knows where it has been moved to? |
the original design file wasnt present |
".tgz", | ||
".zip", | ||
".json", | ||
".yml", |
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.
Thanks for working on this area, @mohit-nagaraj.
Will you offer an explanation as to why this change on these lines is needed?
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.
Hey so here, we have this map iterating over valid file extensions. this map is storing only valid file types, so theres no meaning in making it a map of string:bool. since all of them will be true anyways. coming to the actuallogic, SanitizeFile returns a error message not error code. Either we could define it there or the easiest approach was this.
In L48, i changed from error code to error message. This type is only used in one place that just for this one test case. hence made this change. in the message its like "expectedErrMsg: "The file 'valid.txt' could not be processed because the extension '.txt' is not supported by the system..The system is designed to handle files with the following extensions: .yaml, .tar, .tar.gz, .tgz, .zip, .json, .yml."," so when a slice is made the order in which it is generated is maintained when generating error
62eb02e
to
17aaddc
Compare
Just a quick update thought to put it in here Previously, the Test Coverage ImprovementsWith the introduction of the Test Cases Added and CoverageThe following test cases were added to ensure high coverage and reliability:
Lmk if i should add/modify something in here |
{ Still getting a error at this case tho, cause i could find something named catalog in v1beta1. (it had in v1beta2 not sure if we can use it cuz it was commited long ago). Have updated the other test case acc to v1beta1 design |
Re-running workflows... |
files/sanitization.go
Outdated
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.
You can revert these changes as well, I think the entire fix for the sanitization test is a one-liner, but I could be wrong. Feel free to elaborate on your choice here.
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.
Not sure how a map of all having bool values to be true is good over a slice which just tells which are the valid extensions. I dont get why we need to include and complicate stuff?
Mentioned it here as well: #738 (comment)
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.
I would wait for Lee to clarify but from my understanding it's 2 things:
- Don't fix what ain't broke
- Out of scope for this PR
bonus: Fast lookups, not that it would matter in our case since we've got less than 10 entries
Signed-off-by: Mohit Nagaraj <[email protected]>
Description
This PR fixes #710
Notes for Reviewers
there are few more issues caused due to depreciation of the packages:
edit
updated the opa to use 1.x version
removed the deprecated packages in nat.go
Signed commits