-
Notifications
You must be signed in to change notification settings - Fork 26
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
Adding ignoreSubpaths possibility #432
base: main
Are you sure you want to change the base?
Adding ignoreSubpaths possibility #432
Conversation
valibali
commented
Feb 26, 2024
- Getter for IgnoreSubpaths() added
- Cleaning of paths (removing leading and internal control ["../"] elements)
- checkFile() updated
bffe25d
to
33cbd82
Compare
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.
GoGitOps Review
Grade: A+ (99.4%)
Files: 21
Issues: 1
gofmt: 100%
go_vet: 100%
gocyclo: 100%
golint: 95%
pkg/features/getters.go
Line 169: warning: comment on exported function GetIgnoreSubpaths should be of the form "GetIgnoreSubpaths ..." (golint)
ineffassign: 100%
license: 100%
misspell: 100%
This report was generated using GoGitOps.
33cbd82
to
503986a
Compare
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.
Could you add a couple of tests for this as well please?
return err | ||
} | ||
for _, subpath := range ignoreSubpaths { | ||
// Remove any leading "../" from the subpath |
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.
This is a surprising thing, why are we removing some part of the path that the user has supplied?
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 thought users would give a path with a potential leading "../", (which would never match), but later I figured it's unlikely.
I'll update the docs that the given paths should be relative to the application base directory.
subpath = subpath[len("../"):] | ||
} | ||
|
||
if strings.Contains(path, filepath.Clean(subpath)) { |
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'd like a solid match here. We're only matching directories, so I'd check for IsDir()
and matching, and then return SkipDir
instead.
If I have
/bar
/foo/bar
And I ignore /bar
I'd like it only to ignore the first path, not the second.
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.
Gosh, that was lame. You're absolutely right. I'm doing the update.
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.
GoGitOps Review
Grade: A+ (100.0%)
Files: 21
Issues: 0
gofmt: 100%
go_vet: 100%
gocyclo: 100%
golint: 100%
ineffassign: 100%
license: 100%
misspell: 100%
This report was generated using GoGitOps.
Hey @valibali. Any update on this? Thanks |
Yo. |