Skip to content

Commit

Permalink
SDK Format
Browse files Browse the repository at this point in the history
Switch to the SDK build of `dotnet format`, and reformat the codebase.
  • Loading branch information
iwillspeak committed Jun 17, 2024
1 parent f4ac9c5 commit 8cb845f
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 16 deletions.
8 changes: 1 addition & 7 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
"version": 1,
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "5.1.250801",
"commands": [
"dotnet-format"
]
},
"fantomas": {
"version": "6.0.5",
"commands": [
"fantomas"
]
}
}
}
}
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ jobs:
# a spurious re-build for some reason and ends up in NETSDK1085
# https://github.com/dotnet/fsharp/issues/12320
dotnet pack --configuration $(configuration) --output=$(Build.ArtifactStagingDirectory)
# Check code format. Fantomas for F#, dotnet-format for C#
# Check code format. Fantomas for F#, dotnet format for C#
dotnet tool run fantomas --check .
dotnet tool run dotnet-format --check
dotnet format --verify-no-changes
- task: PublishTestResults@2
condition: always()
inputs:
Expand Down
2 changes: 1 addition & 1 deletion reformat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ workspace="$( dirname "${BASH_SOURCE[0]}" )"

dotnet tool restore
dotnet tool run fantomas -r "${workspace}"
dotnet tool run dotnet-format -f "${workspace}"
dotnet dotnet format "${workspace}"
2 changes: 1 addition & 1 deletion src/Serehfa/Booleans.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static object IsBoolean(object[] args)
public static object BooleanEq(object[] args)
{
CheckAtLeastArgs(args, 2);
if (!(args[0] is bool comparand))
if (args[0] is not bool comparand)
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Serehfa/Ident.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Serehfa
{
public class Ident
{
private string _id;
private readonly string _id;

public Ident(string id)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Serehfa/RandomBits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public static object RandomDouble(object[] args)
}
}

private static Random s_RandomInstance = new Random();
private static readonly Random s_RandomInstance = new();
}
}
2 changes: 1 addition & 1 deletion src/Serehfa/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class Strings
public static object StringEquals(object[] args)
{
CheckAtLeastArgs(args, 2);
if (!(args[0] is string comparand))
if (args[0] is not string comparand)
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Serehfa/Symbols.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static object IsSymbol(object[] args)
public static object SymbolEquals(object[] args)
{
CheckAtLeastArgs(args, 2);
if (!(args[0] is Ident comparand))
if (args[0] is not Ident comparand)
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Serehfa/Undefined.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Serehfa
/// </summary>
public class Undefined
{
private static Lazy<Undefined> s_Instance = new Lazy<Undefined>();
private static readonly Lazy<Undefined> s_Instance = new();

/// <summary>Shared instance of the undefined type. References to this
/// are emitted by the compiler when an undefined value is required.
Expand Down

0 comments on commit 8cb845f

Please sign in to comment.