-
Notifications
You must be signed in to change notification settings - Fork 190
refactor: lint #3776
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
refactor: lint #3776
Conversation
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
✅ Deploy Preview for zarf-docs canceled.
|
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Codecov ReportAttention: Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
hack/lint-all-zarf-packages.sh
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.
Deleting this as I introduced this script alongside the zarf dev lint
command, and have not used the script since. Additionally, because zarf dev lint
now forces uses to define package templates (this behavior is consistent with zarf package create
) the script will break on packages with templates
src/internal/packager2/lint.go
Outdated
) | ||
|
||
// Lint lints the given Zarf package | ||
func Lint(ctx context.Context, packagePath, flavor string, setVariables map[string]string) error { |
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.
blocking: packagePath appears to be a required param here, i'd recommend checking if the path is empty string (and, even better, checking if isn't a valid path) and providing a semantic error to the user if so.
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.
Added an empty check to packagePath
. IMO it's better to leave the valid path checks to the os
package. It will be caught right away.
return err | ||
} | ||
|
||
// [DEPRECATION] Set the Package Variable syntax as well for backward compatibility |
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.
Good comment 👍
// LintError represents an error containing lint findings. | ||
// | ||
//nolint:revive // ignore name | ||
type LintError struct { |
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.
Error types ++
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
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.
LGTM
Signed-off-by: Austin Abro <AustinAbro321@gmail.com> Signed-off-by: NevinAragam <nevin.aragam@gmail.com>
Description
Lint was using src/pkg/packager which will be replaced by packager2.
This comes with behavior changes in Lint that must be made to delete
src/pkg/packager
without greatly increasing complexity or duplicating lots of code.zarf package create
did not have schema checks so packages could have invalid schemas as still be used. Now that a package with an invalid schema will always fail create, earlier validation makes sense.For example, before this PR a warning looks like this:
After this PR they look like this:
Checklist before merging