-
Notifications
You must be signed in to change notification settings - Fork 564
[Xamarin.Android.Build.Tasks] Remove Unsupported Lint Checks #975
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
Conversation
|
build |
|
|
||
| foreach (var issue in DisabledIssuesByVersion) { | ||
| if (lintToolVersion < issue.Value) { | ||
| Regex issueReplaceRegex = new Regex ($"{issue.Key}(,)?"); |
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.
Instead of (,)?, I think this should use $@"\b{issue.Key}\b" (word boundaries), so that e.g. UnusedResourcesAreFun isn't matched against UnusedResources. \b would also "match" ,.
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.
We still need the (,)? because we want to remove a ending comma with the string replace.
Foo,Foo1,Foo2
if we don't include the comma we end up with
Foo,,Foo2
or
Foo,Foo1,
both of which lint will complain about. That said adding the word boundaries should work too.
| foreach (var issue in DisabledIssuesByVersion) { | ||
| if (lintToolVersion < issue.Value) { | ||
| Regex issueReplaceRegex = new Regex ($"{issue.Key}(,)?"); | ||
| if (!string.IsNullOrEmpty (DisabledIssues) && DisabledIssues.Contains (issue.Key)) { |
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.
This block and the following block are largely identical in structure, they just deal with different variables. This should be factored out into a method.
|
|
||
| string CleanIssues (string issueToRemove, Version lintToolVersion, string issues, string issuePropertyName) | ||
| { | ||
| Regex issueReplaceRegex = new Regex ($"\b{issueToRemove}\b(,)?"); |
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.
You don't need the ,. The \b word boundary will still be triggered at a comma.
var r = new Regex(@"\bFoo\b");
r.Match ("Foo").Success; // true
r.Match ("Foo,").Success; // true
r.Match ("Foo,Bar").Success; // true
r.Match ("FooBar").Success; // falseIf a user provides lint checks which are not supported by the current lint version it will error. Invalid id or ategory "StatckFieldLeak" This is normally ok. But in our build system we sometimes end up on a bot which has an older version of lint. And in this case the test fails, which in reality it should ignore the id we are trying to use. So this commit addds some validation to the Disabled and Enabled checks. If its not supported we will remove the check and issue a warning.
Changes: dotnet/java-interop@2a882d2...4787e01 * dotnet/java-interop@4787e017: [Java.Base-Tests] Test Java-to-Managed invocations for Java.Base (dotnet#975) * dotnet/java-interop@59716252: [build] `main` *conceptually* targets .NET 7 (dotnet#978) * dotnet/java-interop@61cdb40d: [generator] Fix reserved keywords binary search (dotnet#977)
Changes: dotnet/java-interop@2a882d2...843f3c7 * dotnet/java-interop@843f3c78: [Java.Base-Tests] Use $(UtilityOutputFullPath)/jcw-gen.dll (#979) * dotnet/java-interop@4787e017: [Java.Base-Tests] Test Java-to-Managed invocations for Java.Base (#975) * dotnet/java-interop@59716252: [build] `main` *conceptually* targets .NET 7 (#978) * dotnet/java-interop@61cdb40d: [generator] Fix reserved keywords binary search (#977)
Changes: dotnet/java-interop@2a882d2...843f3c7 * dotnet/java-interop@843f3c78: [Java.Base-Tests] Use $(UtilityOutputFullPath)/jcw-gen.dll (#979) * dotnet/java-interop@4787e017: [Java.Base-Tests] Test Java-to-Managed invocations for Java.Base (#975) * dotnet/java-interop@59716252: [build] `main` *conceptually* targets .NET 7 (#978) * dotnet/java-interop@61cdb40d: [generator] Fix reserved keywords binary search (#977)
If a user provides lint checks which are not supported by
the current lint version it will error.
This is normally ok. But in our build system we sometimes end up
on a bot which has an older version of lint. And in this case
the test fails, which in reality it should ignore the id we
are trying to use.
So this commit addds some validation to the Disabled and Enabled
checks. If its not supported we will remove the check and issue
a warning.