1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-14 00:53:19 +08:00

Merge pull request #15174 from peppy/disable-stupid-syntax

Disable new null check inspections which we won't be using
This commit is contained in:
Dan Balasescu 2021-10-18 15:10:55 +09:00 committed by GitHub
commit cd80d8eb51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 10 deletions

View File

@ -39,17 +39,19 @@ namespace osu.Game.Online.API
if (string.IsNullOrEmpty(username)) throw new ArgumentException("Missing username."); if (string.IsNullOrEmpty(username)) throw new ArgumentException("Missing username.");
if (string.IsNullOrEmpty(password)) throw new ArgumentException("Missing password."); if (string.IsNullOrEmpty(password)) throw new ArgumentException("Missing password.");
using (var req = new AccessTokenRequestPassword(username, password) var accessTokenRequest = new AccessTokenRequestPassword(username, password)
{ {
Url = $@"{endpoint}/oauth/token", Url = $@"{endpoint}/oauth/token",
Method = HttpMethod.Post, Method = HttpMethod.Post,
ClientId = clientId, ClientId = clientId,
ClientSecret = clientSecret ClientSecret = clientSecret
}) };
using (accessTokenRequest)
{ {
try try
{ {
req.Perform(); accessTokenRequest.Perform();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -60,7 +62,7 @@ namespace osu.Game.Online.API
try try
{ {
// attempt to decode a displayable error string. // attempt to decode a displayable error string.
var error = JsonConvert.DeserializeObject<OAuthError>(req.GetResponseString() ?? string.Empty); var error = JsonConvert.DeserializeObject<OAuthError>(accessTokenRequest.GetResponseString() ?? string.Empty);
if (error != null) if (error != null)
throwableException = new APIException(error.UserDisplayableError, ex); throwableException = new APIException(error.UserDisplayableError, ex);
} }
@ -71,7 +73,7 @@ namespace osu.Game.Online.API
throw throwableException; throw throwableException;
} }
Token.Value = req.ResponseObject; Token.Value = accessTokenRequest.ResponseObject;
} }
} }
@ -79,17 +81,19 @@ namespace osu.Game.Online.API
{ {
try try
{ {
using (var req = new AccessTokenRequestRefresh(refresh) var refreshRequest = new AccessTokenRequestRefresh(refresh)
{ {
Url = $@"{endpoint}/oauth/token", Url = $@"{endpoint}/oauth/token",
Method = HttpMethod.Post, Method = HttpMethod.Post,
ClientId = clientId, ClientId = clientId,
ClientSecret = clientSecret ClientSecret = clientSecret
}) };
{
req.Perform();
Token.Value = req.ResponseObject; using (refreshRequest)
{
refreshRequest.Perform();
Token.Value = refreshRequest.ResponseObject;
return true; return true;
} }
} }

View File

@ -73,6 +73,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToLocalFunction/@EntryIndexedValue">HINT</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToLocalFunction/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToStaticClass/@EntryIndexedValue">WARNING</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToStaticClass/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToUsingDeclaration/@EntryIndexedValue">HINT</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToUsingDeclaration/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertTypeCheckPatternToNullCheck/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=DoubleNegationOperator/@EntryIndexedValue">WARNING</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=DoubleNegationOperator/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EmptyGeneralCatchClause/@EntryIndexedValue">DO_NOT_SHOW</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EmptyGeneralCatchClause/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceDoWhileStatementBraces/@EntryIndexedValue">WARNING</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceDoWhileStatementBraces/@EntryIndexedValue">WARNING</s:String>