Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code style checking workflow using CSharpier #217

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.25.0",
"commands": [
"dotnet-csharpier"
]
}
}
}
25 changes: 25 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Code style

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
code-style:
name: Code style
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- name: Restore tools
run: dotnet tool restore
- name: Check code style
run: dotnet csharpier --check .
2 changes: 1 addition & 1 deletion src/SharpProp/CoolProp/AbstractState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ public double KeyedOutput(Parameters key)
SwigExceptions.ThrowPendingException();
return result;
}
}
}
2 changes: 1 addition & 1 deletion src/SharpProp/CoolProp/AbstractStatePInvoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ double secondInput

[DllImport(Library.Name, EntryPoint = "CSharp_AbstractState_keyed_output")]
public static extern double KeyedOutput(HandleRef abstractState, int key);
}
}
2 changes: 1 addition & 1 deletion src/SharpProp/CoolProp/CoolProp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ double thirdInputValue
return result;
}
}
}
}
2 changes: 1 addition & 1 deletion src/SharpProp/CoolProp/CoolPropPInvoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public static extern double HAPropsSI(
string thirdInputKey,
double thirdInputValue
);
}
}
2 changes: 1 addition & 1 deletion src/SharpProp/CoolProp/DoubleVector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@ public void Dispose()
_currentObject = null;
}
}
}
}
2 changes: 1 addition & 1 deletion src/SharpProp/CoolProp/DoubleVectorPInvoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ double item

[DllImport(Library.Name, EntryPoint = "CSharp_delete_DoubleVector")]
public static extern void Delete(HandleRef doubleVector);
}
}
2 changes: 1 addition & 1 deletion src/SharpProp/CoolProp/Library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
internal static class Library
{
public const string Name = "libCoolProp";
}
}
11 changes: 6 additions & 5 deletions src/SharpProp/CoolProp/SwigExceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
[ExcludeFromCodeCoverage]
internal static class SwigExceptions
{
[ThreadStatic] private static Exception? _pendingException;
[ThreadStatic]
private static Exception? _pendingException;

private static int _pendingExceptionsCount;
private static readonly object ExceptionsLock = new();
Expand Down Expand Up @@ -83,9 +84,9 @@ private static void Set(Exception? exception)
if (_pendingException is not null)
throw new ApplicationException(
"FATAL: An earlier pending exception from "
+ "unmanaged code was missed and thus not thrown ("
+ _pendingException
+ ")",
+ "unmanaged code was missed and thus not thrown ("
+ _pendingException
+ ")",
exception
);
_pendingException = exception;
Expand Down Expand Up @@ -203,4 +204,4 @@ string argumentName
);

private delegate void ExceptionDelegate(string message);
}
}
2 changes: 1 addition & 1 deletion src/SharpProp/Enums/FluidInfoAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ public FluidInfoAttribute(
/// Maximum possible fraction.
/// </summary>
public double FractionMax { get; }
}
}
Loading