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

Adding ignoreSubpaths possibility #432

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

valibali
Copy link

  • Getter for IgnoreSubpaths() added
  • Cleaning of paths (removing leading and internal control ["../"] elements)
  • checkFile() updated

@valibali valibali force-pushed the feature/add-ignore-subpath-feature branch 2 times, most recently from bffe25d to 33cbd82 Compare February 26, 2024 12:35
Copy link

@github-actions github-actions bot left a 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.

pkg/features/getters.go Outdated Show resolved Hide resolved
@valibali valibali force-pushed the feature/add-ignore-subpath-feature branch from 33cbd82 to 503986a Compare February 26, 2024 12:59
Copy link
Contributor

@Joibel Joibel left a 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
Copy link
Contributor

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?

Copy link
Author

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)) {
Copy link
Contributor

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.

Copy link
Author

@valibali valibali Feb 26, 2024

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.

Copy link

@github-actions github-actions bot left a 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.

@tico24
Copy link
Collaborator

tico24 commented Apr 15, 2024

Hey @valibali. Any update on this? Thanks

@valibali
Copy link
Author

Yo.
I'm super overloaded but this one is not forgotten.
I think I can do this next week.

@Joibel Joibel added the stale label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants