-
Notifications
You must be signed in to change notification settings - Fork 172
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
Conversation
Format 500
src/CodeFormatter.cs
Outdated
// Ignore generated code files. | ||
return true; | ||
} | ||
else if (!filesToIgnore.IsEmpty && filesToIgnore.Any(f => document.FilePath.Contains(f, StringComparison.OrdinalIgnoreCase))) |
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.
Do we want to have ignore casing on this string compare? If so, should I also add it on :347
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 would expect Program.GetFiles
to normalize casing and make it consistent.
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.
Also, since the paths should be normalized, I think .StartsWith
might be "more correct" here.
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.
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.
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.
Thanks @jpshrader. This looks good, just want to update the resource string before merging.
src/CodeFormatter.cs
Outdated
// Ignore generated code files. | ||
return true; | ||
} | ||
else if (!filesToIgnore.IsEmpty && filesToIgnore.Any(f => document.FilePath.Contains(f, StringComparison.OrdinalIgnoreCase))) |
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 would expect Program.GetFiles
to normalize casing and make it consistent.
src/CodeFormatter.cs
Outdated
// Ignore generated code files. | ||
return true; | ||
} | ||
else if (!filesToIgnore.IsEmpty && filesToIgnore.Any(f => document.FilePath.Contains(f, StringComparison.OrdinalIgnoreCase))) |
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.
Also, since the paths should be normalized, I think .StartsWith
might be "more correct" here.
🎉 |
Thanks @JoeRobich! If you've got anything you'd like a hand with, feel free to give me a shout. |
PR for: #500