1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

Enforce expression body for typical simple ones.

This commit is contained in:
Huo Yaoyuan 2019-11-12 18:26:42 +08:00
parent 8a1b70513c
commit ca52d09e81
4 changed files with 27 additions and 33 deletions

View File

@ -132,12 +132,13 @@ csharp_preferred_modifier_order = public,private,protected,internal,new,abstract
# Skipped because roslyn cannot separate +-*/ with << >> # Skipped because roslyn cannot separate +-*/ with << >>
#Style - expression bodies #Style - expression bodies
csharp_style_expression_bodied_accessors = true:silent csharp_style_expression_bodied_accessors = true:warning
csharp_style_expression_bodied_constructors = false:none csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_indexers = true:silent csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_methods = true:silent csharp_style_expression_bodied_methods = true:silent
csharp_style_expression_bodied_operators = true:silent csharp_style_expression_bodied_operators = true:warning
csharp_style_expression_bodied_properties = true:silent csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_local_functions = true:silent
#Style - expression preferences #Style - expression preferences
dotnet_style_object_initializer = true:warning dotnet_style_object_initializer = true:warning
@ -166,7 +167,6 @@ csharp_style_inlined_variable_declaration = true:warning
csharp_style_deconstructed_variable_declaration = true:warning csharp_style_deconstructed_variable_declaration = true:warning
#Style - other C# 7.x features #Style - other C# 7.x features
csharp_style_expression_bodied_local_functions = true:silent
dotnet_style_prefer_inferred_tuple_names = true:warning dotnet_style_prefer_inferred_tuple_names = true:warning
csharp_prefer_simple_default_expression = true:warning csharp_prefer_simple_default_expression = true:warning
csharp_style_pattern_local_over_anonymous_function = true:silent csharp_style_pattern_local_over_anonymous_function = true:silent

View File

@ -50,17 +50,14 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"user_votes")] [JsonProperty(@"user_votes")]
private List<long> userVotes private List<long> userVotes
{ {
set set => value.ForEach(v =>
{ {
value.ForEach(v => Comments.ForEach(c =>
{ {
Comments.ForEach(c => if (v == c.Id)
{ c.IsVoted = true;
if (v == c.Id)
c.IsVoted = true;
});
}); });
} });
} }
private List<User> users; private List<User> users;

View File

@ -48,31 +48,28 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
protected APILegacyScores Scores protected APILegacyScores Scores
{ {
set set => Schedule(() =>
{ {
Schedule(() => topScoresContainer.Clear();
if (value?.Scores.Any() != true)
{ {
topScoresContainer.Clear(); scoreTable.Scores = null;
scoreTable.Hide();
return;
}
if (value?.Scores.Any() != true) scoreTable.Scores = value.Scores;
{ scoreTable.Show();
scoreTable.Scores = null;
scoreTable.Hide();
return;
}
scoreTable.Scores = value.Scores; var topScore = value.Scores.First();
scoreTable.Show(); var userScore = value.UserScore;
var topScore = value.Scores.First(); topScoresContainer.Add(new DrawableTopScore(topScore));
var userScore = value.UserScore;
topScoresContainer.Add(new DrawableTopScore(topScore)); if (userScore != null && userScore.Score.OnlineScoreID != topScore.OnlineScoreID)
topScoresContainer.Add(new DrawableTopScore(userScore.Score, userScore.Position));
if (userScore != null && userScore.Score.OnlineScoreID != topScore.OnlineScoreID) });
topScoresContainer.Add(new DrawableTopScore(userScore.Score, userScore.Position));
});
}
} }
public ScoresContainer() public ScoresContainer()

View File

@ -129,7 +129,7 @@ namespace osu.Game.Users
[JsonProperty] [JsonProperty]
private string[] playstyle private string[] playstyle
{ {
set { PlayStyles = value?.Select(str => Enum.Parse(typeof(PlayStyle), str, true)).Cast<PlayStyle>().ToArray(); } set => PlayStyles = value?.Select(str => Enum.Parse(typeof(PlayStyle), str, true)).Cast<PlayStyle>().ToArray();
} }
public PlayStyle[] PlayStyles; public PlayStyle[] PlayStyles;