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

format-500: Add --exclude option to ignore given files/folders #529

Merged
merged 10 commits into from Feb 12, 2020
Merged

format-500: Add --exclude option to ignore given files/folders #529

merged 10 commits into from Feb 12, 2020

Conversation

ghost
Copy link

@ghost ghost commented Feb 11, 2020

PR for: #500

@ghost ghost requested review from JoeRobich, sandyarmstrong and jmarolf February 11, 2020 06:23
// Ignore generated code files.
return true;
}
else if (!filesToIgnore.IsEmpty && filesToIgnore.Any(f => document.FilePath.Contains(f, StringComparison.OrdinalIgnoreCase)))
Copy link
Author

Choose a reason for hiding this comment

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

Do we want to have ignore casing on this string compare? If so, should I also add it on :347

Copy link
Member

Choose a reason for hiding this comment

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

I would expect Program.GetFiles to normalize casing and make it consistent.

Copy link
Member

Choose a reason for hiding this comment

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

Also, since the paths should be normalized, I think .StartsWith might be "more correct" here.

Copy link
Author

Choose a reason for hiding this comment

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

Changed it to StartsWith, but I still need to keep the StringComparison bit since we're doing document.FilePath.StartsWith. Unlike the ImmutableHashset, document.FilePath's comparer doesn't ignore casing.

Copy link
Member

@JoeRobich JoeRobich left a comment

Choose a reason for hiding this comment

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

Thanks @jpshrader. This looks good, just want to update the resource string before merging.

// Ignore generated code files.
return true;
}
else if (!filesToIgnore.IsEmpty && filesToIgnore.Any(f => document.FilePath.Contains(f, StringComparison.OrdinalIgnoreCase)))
Copy link
Member

Choose a reason for hiding this comment

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

I would expect Program.GetFiles to normalize casing and make it consistent.

src/Resources.resx Outdated Show resolved Hide resolved
// Ignore generated code files.
return true;
}
else if (!filesToIgnore.IsEmpty && filesToIgnore.Any(f => document.FilePath.Contains(f, StringComparison.OrdinalIgnoreCase)))
Copy link
Member

Choose a reason for hiding this comment

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

Also, since the paths should be normalized, I think .StartsWith might be "more correct" here.

@JoeRobich
Copy link
Member

🎉

@JoeRobich JoeRobich merged commit 87e15d7 into dotnet:master Feb 12, 2020
@ghost
Copy link
Author

ghost commented Feb 12, 2020

Thanks @JoeRobich! If you've got anything you'd like a hand with, feel free to give me a shout.

@JoeRobich JoeRobich mentioned this pull request Feb 13, 2020
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