add dotnet-format as pre-commit hook

This commit is contained in:
Liza 2022-12-01 17:56:26 +01:00
parent e6c56e5bce
commit 3c6822aa64
5 changed files with 16 additions and 9 deletions

7
.githooks/pre-commit Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
#
# Use with:
#
# $> git config core.hooksPath .githooks
#
dotnet format --exclude vendor/

View File

@ -14,7 +14,7 @@ namespace Pal.Client
{ {
private static readonly JsonSerializerOptions _jsonSerializerOptions = new JsonSerializerOptions { IncludeFields = true }; private static readonly JsonSerializerOptions _jsonSerializerOptions = new JsonSerializerOptions { IncludeFields = true };
private static readonly int _currentVersion = 3; private static readonly int _currentVersion = 3;
public uint TerritoryType { get; set; } public uint TerritoryType { get; set; }
public ConcurrentBag<Marker> Markers { get; set; } = new(); public ConcurrentBag<Marker> Markers { get; set; } = new();

View File

@ -14,8 +14,8 @@ namespace Pal.Client.Net
_name = name; _name = name;
} }
public IDisposable BeginScope<TState>(TState state) public IDisposable BeginScope<TState>(TState state)
where TState: notnull where TState : notnull
=> NullScope.Instance; => NullScope.Instance;
public bool IsEnabled(LogLevel logLevel) => logLevel != LogLevel.None; public bool IsEnabled(LogLevel logLevel) => logLevel != LogLevel.None;

View File

@ -190,7 +190,7 @@ namespace Pal.Client
{ {
Splatoon.RemoveDynamicElements(SPLATOON_TRAP_HOARD); Splatoon.RemoveDynamicElements(SPLATOON_TRAP_HOARD);
Splatoon.RemoveDynamicElements(SPLATOON_REGULAR_COFFERS); Splatoon.RemoveDynamicElements(SPLATOON_REGULAR_COFFERS);
} }
catch catch
{ {
// destroyed on territory change either way // destroyed on territory change either way
@ -335,7 +335,7 @@ namespace Pal.Client
// markers discovered afterwards are automatically marked seen. // markers discovered afterwards are automatically marked seen.
if (accountId != null && knownMarker.NetworkId != null && !knownMarker.RemoteSeenRequested && !knownMarker.RemoteSeenOn.Contains(accountId.Value)) if (accountId != null && knownMarker.NetworkId != null && !knownMarker.RemoteSeenRequested && !knownMarker.RemoteSeenOn.Contains(accountId.Value))
updateSeenMarkers = true; updateSeenMarkers = true;
continue; continue;
} }
@ -667,7 +667,7 @@ namespace Pal.Client
case 2009504: case 2009504:
result.Add(new Marker(Marker.EType.Trap, obj.Position) { Seen = true }); result.Add(new Marker(Marker.EType.Trap, obj.Position) { Seen = true });
break; break;
case 2007542: case 2007542:
case 2007543: case 2007543:
result.Add(new Marker(Marker.EType.Hoard, obj.Position) { Seen = true }); result.Add(new Marker(Marker.EType.Hoard, obj.Position) { Seen = true });
@ -683,11 +683,11 @@ namespace Pal.Client
} }
internal bool IsInDeepDungeon() => internal bool IsInDeepDungeon() =>
Service.ClientState.IsLoggedIn Service.ClientState.IsLoggedIn
&& Service.Condition[ConditionFlag.InDeepDungeon] && Service.Condition[ConditionFlag.InDeepDungeon]
&& typeof(ETerritoryType).IsEnumDefined(Service.ClientState.TerritoryType); && typeof(ETerritoryType).IsEnumDefined(Service.ClientState.TerritoryType);
internal static Element CreateSplatoonElement(Marker.EType type, Vector3 pos, Vector4 color, bool fill = false) internal static Element CreateSplatoonElement(Marker.EType type, Vector3 pos, Vector4 color, bool fill = false)
=> CreateSplatoonElement(type, pos, ImGui.ColorConvertFloat4ToU32(color), fill); => CreateSplatoonElement(type, pos, ImGui.ColorConvertFloat4ToU32(color), fill);
internal static Element CreateSplatoonElement(Marker.EType type, Vector3 pos, uint color, bool fill = false) internal static Element CreateSplatoonElement(Marker.EType type, Vector3 pos, uint color, bool fill = false)

View File

@ -74,7 +74,7 @@ namespace Pal.Client.Windows
territoryStatistics.TrapCount = null; territoryStatistics.TrapCount = null;
territoryStatistics.HoardCofferCount = null; territoryStatistics.HoardCofferCount = null;
} }
foreach (var floor in floorStatistics) foreach (var floor in floorStatistics)
{ {
if (_territoryStatistics.TryGetValue((ETerritoryType)floor.TerritoryType, out TerritoryStatistics? territoryStatistics)) if (_territoryStatistics.TryGetValue((ETerritoryType)floor.TerritoryType, out TerritoryStatistics? territoryStatistics))