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

feat: add husky to run csharpier #1622

Closed
wants to merge 1 commit into from
Closed
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
18 changes: 18 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 1,
"isRoot": true,
"tools": {
"husky": {
"version": "0.6.3",
"commands": [
"husky"
]
},
"csharpier": {
"version": "0.26.3",
"commands": [
"dotnet-csharpier"
]
}
}
}
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
# shellcheck source=/dev/null
. "$(dirname "$0")/_/husky.sh"

dotnet husky run
16 changes: 16 additions & 0 deletions .husky/task-runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"tasks": [
{
"name": "Run csharpier",
"command": "dotnet",
"args": [
"csharpier",
"${staged}"
],
"include": [
"**/*.cs"
]
}
]
}

6 changes: 6 additions & 0 deletions Refit/Refit.csproj
Original file line number Diff line number Diff line change
@@ -8,6 +8,12 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<Target Name="husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High"/>
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High"
WorkingDirectory="../" /> <!--Update this to the relative path to your project root dir -->
</Target>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />

Unchanged files with check annotations Beta

/// <summary>
/// Creates a new <see cref="RefitSettings"/> instance with the default parameters
/// </summary>
public RefitSettings()

Check warning on line 17 in Refit/RefitSettings.cs

GitHub Actions / build / build

Non-nullable property 'HttpRequestMessageOptions' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
{
ContentSerializer = new SystemTextJsonContentSerializer();
UrlParameterFormatter = new DefaultUrlParameterFormatter();
/// <param name="contentSerializer">The <see cref="IHttpContentSerializer"/> instance to use</param>
/// <param name="urlParameterFormatter">The <see cref="IUrlParameterFormatter"/> instance to use (defaults to <see cref="DefaultUrlParameterFormatter"/>)</param>
/// <param name="formUrlEncodedParameterFormatter">The <see cref="IFormUrlEncodedParameterFormatter"/> instance to use (defaults to <see cref="DefaultFormUrlEncodedParameterFormatter"/>)</param>
public RefitSettings(

Check warning on line 31 in Refit/RefitSettings.cs

GitHub Actions / build / build

Non-nullable property 'HttpRequestMessageOptions' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
IHttpContentSerializer contentSerializer,
IUrlParameterFormatter? urlParameterFormatter = null,
IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter = null)
/// </summary>
public RefitSettings RefitSettings { get; }
protected ApiException(HttpRequestMessage message, HttpMethod httpMethod, string? content, HttpStatusCode statusCode, string? reasonPhrase, HttpResponseHeaders headers, RefitSettings refitSettings, Exception? innerException = null) :

Check warning on line 63 in Refit/ApiException.cs

GitHub Actions / build / build

Missing XML comment for publicly visible type or member 'ApiException.ApiException(HttpRequestMessage, HttpMethod, string?, HttpStatusCode, string?, HttpResponseHeaders, RefitSettings, Exception?)'
this(CreateMessage(statusCode, reasonPhrase), message, httpMethod, content, statusCode, reasonPhrase, headers, refitSettings, innerException)
{
}
protected ApiException(string exceptionMessage, HttpRequestMessage message, HttpMethod httpMethod, string? content, HttpStatusCode statusCode, string? reasonPhrase, HttpResponseHeaders headers, RefitSettings refitSettings, Exception? innerException = null) :

Check warning on line 68 in Refit/ApiException.cs

GitHub Actions / build / build

Missing XML comment for publicly visible type or member 'ApiException.ApiException(string, HttpRequestMessage, HttpMethod, string?, HttpStatusCode, string?, HttpResponseHeaders, RefitSettings, Exception?)'
base(exceptionMessage, innerException)
{
RequestMessage = message;
/// </summary>
public RefitSettings Settings { get; }
public HttpResponseHeaders Headers => response.Headers;

Check warning on line 51 in Refit/ApiResponse.cs

GitHub Actions / build / build

Missing XML comment for publicly visible type or member 'ApiResponse<T>.Headers'
public HttpContentHeaders? ContentHeaders => response.Content?.Headers;

Check warning on line 53 in Refit/ApiResponse.cs

GitHub Actions / build / build

Missing XML comment for publicly visible type or member 'ApiResponse<T>.ContentHeaders'
#if NET6_0_OR_GREATER
[MemberNotNullWhen(true, nameof(Content))]
[MemberNotNullWhen(true, nameof(ContentHeaders))]
[MemberNotNullWhen(false, nameof(Error))]
#endif
public bool IsSuccessStatusCode => response.IsSuccessStatusCode;

Check warning on line 60 in Refit/ApiResponse.cs

GitHub Actions / build / build

Missing XML comment for publicly visible type or member 'ApiResponse<T>.IsSuccessStatusCode'
public string? ReasonPhrase => response.ReasonPhrase;

Check warning on line 62 in Refit/ApiResponse.cs

GitHub Actions / build / build

Missing XML comment for publicly visible type or member 'ApiResponse<T>.ReasonPhrase'
public HttpRequestMessage? RequestMessage => response.RequestMessage;

Check warning on line 64 in Refit/ApiResponse.cs

GitHub Actions / build / build

Missing XML comment for publicly visible type or member 'ApiResponse<T>.RequestMessage'
public HttpStatusCode StatusCode => response.StatusCode;

Check warning on line 66 in Refit/ApiResponse.cs

GitHub Actions / build / build

Missing XML comment for publicly visible type or member 'ApiResponse<T>.StatusCode'
public Version Version => response.Version;