-
Notifications
You must be signed in to change notification settings - Fork 519
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
[Xtro] If the sanitizer removed all selectors, remove the file. #12256
[Xtro] If the sanitizer removed all selectors, remove the file. #12256
Conversation
A new check was added to ensure that empty .todo files are not added, yet when the sanitizer removes all lines we get an error per empty file. Since we are auto-sanitizing, we want to remove those empty files.
@@ -177,6 +177,10 @@ static void NoFixedTodo () | |||
foreach (var failure in failures) | |||
sanitized.Remove (failure); | |||
File.WriteAllLines (file, sanitized); | |||
// since we are in AUTO_SANITIZE, if the file is empty, remove it. | |||
if (!(File.ReadLines(file).Count() > 0)) { |
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.
wrong style, space before (
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.
why not simply look if sanitized
is empty ?
instead of reading back the file (that was just written)
@@ -178,7 +178,7 @@ static void NoFixedTodo () | |||
sanitized.Remove (failure); | |||
File.WriteAllLines (file, sanitized); | |||
// since we are in AUTO_SANITIZE, if the file is empty, remove it. | |||
if (!(File.ReadLines(file).Count() > 0)) { | |||
if (!(sanitized.Count () > 0)) { |
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.
Simpler
if (sanitized.Count == 0) {
No LINQ, no negation
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diff✅ API Diff (from PR only) (no change) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results2 tests failed, 86 tests passed.Failed tests
Pipeline on Agent XAMBOT-1101.BigSur' |
A new check was added to ensure that empty .todo files are not added,
yet when the sanitizer removes all lines we get an error per empty file.
Since we are auto-sanitizing, we want to remove those empty files.