Some analyzer code style changes

This commit is contained in:
Asriel Camora
2023-06-19 10:03:57 -07:00
parent 6d61e022b6
commit 05ead22448
50 changed files with 134 additions and 56 deletions
+43 -1
View File
@@ -63,7 +63,7 @@ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:sug
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
dotnet_style_parentheses_in_other_operators=always_for_clarity:silent
dotnet_style_object_initializer = false
dotnet_style_object_initializer = false:suggestion
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
@@ -130,9 +130,51 @@ resharper_suggest_var_or_type_elsewhere_highlighting = hint
resharper_suggest_var_or_type_simple_types_highlighting = hint
resharper_unused_auto_property_accessor_global_highlighting = none
csharp_style_deconstructed_variable_declaration=true:silent
csharp_using_directive_placement = outside_namespace:suggestion
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = file_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_local_functions = true:suggestion
csharp_indent_labels = flush_left
dotnet_diagnostic.MA0049.severity = silent
dotnet_diagnostic.MA0007.severity = silent
dotnet_diagnostic.MA0048.severity = silent
dotnet_diagnostic.MA0006.severity = suggestion
dotnet_diagnostic.MA0016.severity = suggestion
dotnet_diagnostic.MA0008.severity = suggestion
dotnet_diagnostic.CA1805.severity = warning
dotnet_diagnostic.CA1825.severity = warning
dotnet_diagnostic.CA1841.severity = suggestion
dotnet_diagnostic.CA1845.severity = suggestion
dotnet_diagnostic.MA0011.severity = silent
dotnet_diagnostic.MA0076.severity = silent
dotnet_diagnostic.MA0002.severity = silent
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
[*.{appxmanifest,asax,ascx,aspx,axaml,axml,build,c,c++,cc,cginc,compute,config,cp,cpp,cs,cshtml,csproj,css,cu,cuh,cxx,dbml,discomap,dtd,h,hh,hlsl,hlsli,hlslinc,hpp,htm,html,hxx,inc,inl,ino,ipp,js,json,jsproj,jsx,lsproj,master,mpp,mq4,mq5,mqh,njsproj,nuspec,paml,proj,props,proto,razor,resjson,resw,resx,skin,StyleCop,targets,tasks,tpp,ts,tsx,usf,ush,vb,vbproj,xaml,xamlx,xml,xoml,xsd}]
indent_style = space
indent_size = 4
tab_width = 4
dotnet_style_parentheses_in_other_operators=always_for_clarity:silent
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_collection_initializer = true:suggestion
dotnet_diagnostic.CA1852.severity = warning
dotnet_style_namespace_match_folder = true:suggestion
+8
View File
@@ -7,6 +7,14 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ObjectLayoutInspector" Version="0.1.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Simulator\Craftimizer.Simulator.csproj" />
<ProjectReference Include="..\Solver\Craftimizer.Solver.csproj" />
+7 -2
View File
@@ -1,12 +1,17 @@
using Craftimizer.Simulator;
using Craftimizer.Simulator.Actions;
using Craftimizer.Solver.Crafty;
using ObjectLayoutInspector;
namespace Craftimizer.Benchmark;
internal class Program
internal static class Program
{
private static void Main(string[] args)
private static void Main()
{
//TypeLayout.PrintLayout<Solver.Crafty.SimulationNode>(true);
//return;
var input = new SimulationInput()
{
Stats = new CharacterStats { Craftsmanship = 4041, Control = 3905, CP = 609, Level = 90 },
+1 -1
View File
@@ -6,7 +6,7 @@ namespace Craftimizer.Plugin;
[Serializable]
public class Configuration : IPluginConfiguration
{
public int Version { get; set; } = 0;
public int Version { get; set; } = 1;
public void Save()
{
+5 -1
View File
@@ -30,7 +30,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.10" />
<PackageReference Include="DalamudPackager" Version="2.1.11" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<ProjectReference Include="..\Simulator\Craftimizer.Simulator.csproj" />
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
+1 -1
View File
@@ -5,7 +5,7 @@ using System.Numerics;
namespace Craftimizer.Plugin;
internal class ImGuiUtils
internal static class ImGuiUtils
{
private static readonly Stack<(Vector2 Min, Vector2 Max)> GroupPanelLabelStack = new();
+2 -2
View File
@@ -52,7 +52,7 @@ internal static class ActionUtils
var (craftAction, action) = GetActionRow(me, classJob);
if (craftAction != null)
return craftAction.Name.ToDalamudString().TextValue;
else if (action != null)
if (action != null)
return action.Name.ToDalamudString().TextValue;
return "Unknown";
}
@@ -62,7 +62,7 @@ internal static class ActionUtils
var (craftAction, action) = GetActionRow(me, classJob);
if (craftAction != null)
return Icons.GetIconFromId(craftAction.Icon);
else if (action != null)
if (action != null)
return Icons.GetIconFromId(action.Icon);
// Old "Steady Hand" action icon
return Icons.GetIconFromId(1953);
+9 -3
View File
@@ -4,9 +4,15 @@
"net7.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[2.1.10, )",
"resolved": "2.1.10",
"contentHash": "S6NrvvOnLgT4GDdgwuKVJjbFo+8ZEj+JsEYk9ojjOR/MMfv1dIFpT8aRJQfI24rtDcw1uF+GnSSMN4WW1yt7fw=="
"requested": "[2.1.11, )",
"resolved": "2.1.11",
"contentHash": "9qlAWoRRTiL/geAvuwR/g6Bcbrd/bJJgVnB/RurBiyKs6srsP0bvpoo8IK+Eg8EA6jWeM6/YJWs66w4FIAzqPw=="
},
"Meziantou.Analyzer": {
"type": "Direct",
"requested": "[2.0.61, )",
"resolved": "2.0.61",
"contentHash": "DhiEScqTxQb8R7s9EWMjs5F5EA7AD+JO5upb88QqPwPQUsAOm2gN5AjeQon3XLrquw1G5r+C9Yxct+rFxwuMZg=="
},
"craftimizer.simulator": {
"type": "Project"
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class AdvancedTouch : BaseAction
internal sealed class AdvancedTouch : BaseAction
{
public override ActionCategory Category => ActionCategory.Quality;
public override int Level => 84;
+1 -3
View File
@@ -6,9 +6,7 @@ public abstract class BaseAction
{
[ThreadStatic]
internal static Simulator? TLSSimulation;
protected static Simulator Simulation => TLSSimulation ?? throw new NullReferenceException();
public BaseAction() { }
protected static Simulator Simulation => TLSSimulation!;
// Non-instanced properties
public abstract ActionCategory Category { get; }
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class BasicSynthesis : BaseAction
internal sealed class BasicSynthesis : BaseAction
{
public override ActionCategory Category => ActionCategory.Synthesis;
public override int Level => 1;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class BasicTouch : BaseAction
internal sealed class BasicTouch : BaseAction
{
public override ActionCategory Category => ActionCategory.Quality;
public override int Level => 5;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class ByregotsBlessing : BaseAction
internal sealed class ByregotsBlessing : BaseAction
{
public override ActionCategory Category => ActionCategory.Quality;
public override int Level => 50;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class CarefulObservation : BaseAction
internal sealed class CarefulObservation : BaseAction
{
public override ActionCategory Category => ActionCategory.Other;
public override int Level => 55;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class CarefulSynthesis : BaseAction
internal sealed class CarefulSynthesis : BaseAction
{
public override ActionCategory Category => ActionCategory.Synthesis;
public override int Level => 62;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class DelicateSynthesis : BaseAction
internal sealed class DelicateSynthesis : BaseAction
{
public override ActionCategory Category => ActionCategory.Synthesis;
public override int Level => 76;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class FinalAppraisal : BaseBuffAction
internal sealed class FinalAppraisal : BaseBuffAction
{
public override ActionCategory Category => ActionCategory.Synthesis;
public override int Level => 42;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class FocusedSynthesis : BaseAction
internal sealed class FocusedSynthesis : BaseAction
{
public override ActionCategory Category => ActionCategory.Synthesis;
public override int Level => 67;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class FocusedTouch : BaseAction
internal sealed class FocusedTouch : BaseAction
{
public override ActionCategory Category => ActionCategory.Quality;
public override int Level => 68;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class GreatStrides : BaseBuffAction
internal sealed class GreatStrides : BaseBuffAction
{
public override ActionCategory Category => ActionCategory.Buffs;
public override int Level => 21;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class Groundwork : BaseAction
internal sealed class Groundwork : BaseAction
{
public override ActionCategory Category => ActionCategory.Synthesis;
public override int Level => 72;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class HastyTouch : BaseAction
internal sealed class HastyTouch : BaseAction
{
public override ActionCategory Category => ActionCategory.Quality;
public override int Level => 9;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class HeartAndSoul : BaseBuffAction
internal sealed class HeartAndSoul : BaseBuffAction
{
public override ActionCategory Category => ActionCategory.Other;
public override int Level => 86;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class Innovation : BaseBuffAction
internal sealed class Innovation : BaseBuffAction
{
public override ActionCategory Category => ActionCategory.Buffs;
public override int Level => 26;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class IntensiveSynthesis : BaseAction
internal sealed class IntensiveSynthesis : BaseAction
{
public override ActionCategory Category => ActionCategory.Synthesis;
public override int Level => 78;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class Manipulation : BaseBuffAction
internal sealed class Manipulation : BaseBuffAction
{
public override ActionCategory Category => ActionCategory.Durability;
public override int Level => 65;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class MastersMend : BaseAction
internal sealed class MastersMend : BaseAction
{
public override ActionCategory Category => ActionCategory.Durability;
public override int Level => 7;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class MuscleMemory : BaseAction
internal sealed class MuscleMemory : BaseAction
{
public override ActionCategory Category => ActionCategory.FirstTurn;
public override int Level => 54;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class Observe : BaseAction
internal sealed class Observe : BaseAction
{
public override ActionCategory Category => ActionCategory.Other;
public override int Level => 13;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class PreciseTouch : BaseAction
internal sealed class PreciseTouch : BaseAction
{
public override ActionCategory Category => ActionCategory.Quality;
public override int Level => 53;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class PreparatoryTouch : BaseAction
internal sealed class PreparatoryTouch : BaseAction
{
public override ActionCategory Category => ActionCategory.Quality;
public override int Level => 71;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class PrudentSynthesis : BaseAction
internal sealed class PrudentSynthesis : BaseAction
{
public override ActionCategory Category => ActionCategory.Synthesis;
public override int Level => 88;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class PrudentTouch : BaseAction
internal sealed class PrudentTouch : BaseAction
{
public override ActionCategory Category => ActionCategory.Quality;
public override int Level => 66;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class RapidSynthesis : BaseAction
internal sealed class RapidSynthesis : BaseAction
{
public override ActionCategory Category => ActionCategory.Synthesis;
public override int Level => 9;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class Reflect : BaseAction
internal sealed class Reflect : BaseAction
{
public override ActionCategory Category => ActionCategory.FirstTurn;
public override int Level => 69;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class StandardTouch : BaseAction
internal sealed class StandardTouch : BaseAction
{
public override ActionCategory Category => ActionCategory.Quality;
public override int Level => 18;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class TrainedEye : BaseAction
internal sealed class TrainedEye : BaseAction
{
public override ActionCategory Category => ActionCategory.FirstTurn;
public override int Level => 80;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class TrainedFinesse : BaseAction
internal sealed class TrainedFinesse : BaseAction
{
public override ActionCategory Category => ActionCategory.Quality;
public override int Level => 90;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class TricksOfTheTrade : BaseAction
internal sealed class TricksOfTheTrade : BaseAction
{
public override ActionCategory Category => ActionCategory.Other;
public override int Level => 13;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class Veneration : BaseBuffAction
internal sealed class Veneration : BaseBuffAction
{
public override ActionCategory Category => ActionCategory.Buffs;
public override int Level => 15;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class WasteNot : BaseBuffAction
internal sealed class WasteNot : BaseBuffAction
{
public override ActionCategory Category => ActionCategory.Durability;
public override int Level => 15;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator.Actions;
internal class WasteNot2 : BaseBuffAction
internal sealed class WasteNot2 : BaseBuffAction
{
public override ActionCategory Category => ActionCategory.Durability;
public override int Level => 47;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator;
public record CharacterStats
public sealed record CharacterStats
{
public int Craftsmanship { get; init; }
public int Control { get; init; }
+7
View File
@@ -6,4 +6,11 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator;
public record RecipeInfo
public sealed record RecipeInfo
{
public bool IsExpert { get; init; }
public int ClassJobLevel { get; init; }
-2
View File
@@ -1,5 +1,3 @@
using System;
namespace Craftimizer.Simulator;
public readonly record struct SimulationInput
+7
View File
@@ -6,6 +6,13 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Simulator\Craftimizer.Simulator.csproj" />
</ItemGroup>
+1 -1
View File
@@ -7,7 +7,7 @@ namespace Craftimizer.Solver.Crafty;
public sealed class ActionSet
{
private uint Bits { get; set; } = 0;
private uint Bits { get; set; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int NthBitSet(uint value, int n)
+4 -4
View File
@@ -1,8 +1,8 @@
namespace Craftimizer.Solver.Crafty;
public class NodeScores
public sealed class NodeScores
{
public float ScoreSum { get; set; } = 0;
public float MaxScore { get; set; } = 0;
public float Visits { get; set; } = 0;
public float ScoreSum { get; set; }
public float MaxScore { get; set; }
public float Visits { get; set; }
}
+3
View File
@@ -1,5 +1,6 @@
using Craftimizer.Simulator;
using Craftimizer.Simulator.Actions;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace Craftimizer.Solver.Crafty;
@@ -213,6 +214,7 @@ public class Solver
return (actions, state);
}
Debugger.Break();
var solver = new Solver(state, true);
while (!solver.Simulator.IsComplete)
{
@@ -232,6 +234,7 @@ public class Solver
solver = new Solver(state, true);
}
Debugger.Break();
return (actions, state);
}