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

✨ Path inclusion #606

Merged
merged 3 commits into from
May 20, 2024
Merged

✨ Path inclusion #606

merged 3 commits into from
May 20, 2024

Conversation

pranavgaikwad
Copy link
Contributor

@pranavgaikwad pranavgaikwad commented May 16, 2024

Bundle PR: 94

@pranavgaikwad
Copy link
Contributor Author

Finding a way to test this PR with bundle PR

@pranavgaikwad pranavgaikwad marked this pull request as ready for review May 17, 2024 12:49
// if allowFilePaths is not set, path to a file is converted into a path to its base dir
func GetIncludedPathsFromConfig(i InitConfig, allowFilePaths bool) []string {
validatedPaths := []string{}
if includedPaths, ok := i.ProviderSpecificConfig[IncludedPathsConfigKey].([]interface{}); ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to error, or warn if it is not a slice?

Just to make debug of provider config easier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shawn-hurley good point.

absPath = file
}
if !p.isFileIncluded(absPath) {
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially add a high verbosity log here to note why it was removed.

@pranavgaikwad
Copy link
Contributor Author

I am investigating the failing test now, everything is working fine locally, looks like something small.

Copy link
Contributor

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, it looks really good to me; great job!

The only point I have is around the true/false option to use dir when getting a file path, just to understand when a user would want to set that to false.

Also, just a minor point but like 5 or 7 verbosity log when filtering out might be helpful in the future.

@@ -142,3 +142,30 @@ func MultilineGrep(ctx context.Context, window int, path, pattern string) (int,

return -1, scanner.Err()
}

// GetIncludedPathsFromConfig returns validated includedPaths from provider settings
// if allowFilePaths is not set, path to a file is converted into a path to its base dir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you walk me through the use case for this option to be false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shawn-hurley this doesn't affect users, this is for providers...so with Java, we can only scope the path upto granularity of a package (as opposed to a class or file). So if user inputs /util/File.java we can only filter upto /util. I thought this would be potentially useful elsewhere, but I can push this specific logic into java provider too keeping this lib function generic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants