mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-13 11:20:31 +00:00
Enable basic performance rules
This commit is contained in:
@@ -50,6 +50,30 @@ dotnet_diagnostic.IDE1006.severity = warning
|
||||
# Too many noisy warnings for parsing/formatting numbers
|
||||
dotnet_diagnostic.CA1305.severity = none
|
||||
|
||||
# CA1806: Do not ignore method results
|
||||
# Not sure why it's performance, but causing too much noise
|
||||
dotnet_diagnostic.CA1806.severity = none
|
||||
|
||||
# CA1822: Mark members as static
|
||||
# Potential false positive around reflection/too much noise
|
||||
dotnet_diagnostic.CA1822.severity = none
|
||||
|
||||
# CA1826: Do not use Enumerable methods on indexable collections
|
||||
# Noise for FirstOrDefault and LastOrDefault
|
||||
dotnet_diagnostic.CA1826.severity = none
|
||||
|
||||
# CA1859: Use concrete types when possible for improved performance
|
||||
# Involves design considerations
|
||||
dotnet_diagnostic.CA1859.severity = none
|
||||
|
||||
# CA1861: Avoid constant arrays as arguments
|
||||
# Outdated with collection expressions
|
||||
dotnet_diagnostic.CA1861.severity = none
|
||||
|
||||
# CA1868: Unnecessary call to 'Contains(item)'
|
||||
# Causing noises only
|
||||
dotnet_diagnostic.CA1868.severity = none
|
||||
|
||||
# CA2007: Consider calling ConfigureAwait on the awaited task
|
||||
dotnet_diagnostic.CA2007.severity = warning
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
<AnalysisModeGlobalization>Recommended</AnalysisModeGlobalization>
|
||||
<AnalysisModeInteroperability>Recommended</AnalysisModeInteroperability>
|
||||
<AnalysisModeMaintainability>Recommended</AnalysisModeMaintainability>
|
||||
<AnalysisModeNaming>Default</AnalysisModeNaming>
|
||||
<AnalysisModePerformance>Minimum</AnalysisModePerformance>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="NuGet">
|
||||
<Authors>ppy Pty Ltd</Authors>
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Threading;
|
||||
|
||||
@@ -87,7 +88,7 @@ namespace osu.Framework.Tests.Audio
|
||||
|
||||
runScheduled();
|
||||
|
||||
Task.WaitAll(cts.Task);
|
||||
cts.Task.WaitSafely();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ using osu.Framework.Testing;
|
||||
using osu.Framework.Tests.Visual;
|
||||
using osuTK;
|
||||
|
||||
#pragma warning disable CA1826 // Performance for test is not important
|
||||
|
||||
namespace osu.Framework.Tests.Containers
|
||||
{
|
||||
[System.ComponentModel.Description("ensure valid container state in various scenarios")]
|
||||
|
||||
@@ -17,6 +17,8 @@ using osu.Framework.Input;
|
||||
using osu.Framework.Localisation;
|
||||
using osuTK;
|
||||
|
||||
#pragma warning disable CA1826 // Performance for test is not important
|
||||
|
||||
namespace osu.Framework.Tests.Visual.UserInterface
|
||||
{
|
||||
public partial class TestSceneTabControl : FrameworkTestScene
|
||||
|
||||
@@ -137,10 +137,10 @@ namespace osu.Framework.Graphics.Containers
|
||||
/// <returns>The position of the drawable in the layout.</returns>
|
||||
public float GetLayoutPosition(Drawable drawable)
|
||||
{
|
||||
if (!layoutChildren.ContainsKey(drawable))
|
||||
if (!layoutChildren.TryGetValue(drawable, out float value))
|
||||
throw new InvalidOperationException($"Cannot get layout position of drawable which is not contained within this {nameof(FlowContainer<T>)}.");
|
||||
|
||||
return layoutChildren[drawable];
|
||||
return value;
|
||||
}
|
||||
|
||||
protected override bool UpdateChildrenLife()
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace osu.Framework.Graphics.Containers
|
||||
private LocalisationManager localisation { get; set; }
|
||||
|
||||
private readonly Cached filterValid = new Cached();
|
||||
private readonly ICollection<IBindable<bool>> canBeShownBindables = new List<IBindable<bool>>();
|
||||
private readonly List<IBindable<bool>> canBeShownBindables = new List<IBindable<bool>>();
|
||||
|
||||
protected override void AddInternal(Drawable drawable)
|
||||
{
|
||||
|
||||
@@ -182,10 +182,10 @@ namespace osu.Framework.Input.Handlers.Midi
|
||||
// need running status to be interpreted correctly
|
||||
if (statusType <= 0x7F)
|
||||
{
|
||||
if (!runningStatus.ContainsKey(senderId))
|
||||
if (!runningStatus.TryGetValue(senderId, out byte value))
|
||||
throw new InvalidDataException($"Received running status of sender {senderId}, but no event type was stored");
|
||||
|
||||
eventType = runningStatus[senderId];
|
||||
eventType = value;
|
||||
key = statusType;
|
||||
velocity = data[i++];
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user