Skip to content

Commit

Permalink
Linter
Browse files Browse the repository at this point in the history
  • Loading branch information
guibranco committed Nov 14, 2023
1 parent de84e0d commit d4a3b2d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
6 changes: 2 additions & 4 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ LC_ALL=C

local_branch="$(git rev-parse --abbrev-ref HEAD)"

valid_branch_regex="^(feature|fix|docs|style|refactor|perf|hotfix|test|chore|create)\/[a-zA-Z0-9._-]+$"
valid_branch_regex="^(dependabot|feature|fix|docs|style|refactor|perf|hotfix|test|chore|create)(\/[a-zA-Z0-9._-]+)+$"

message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again."

Expand All @@ -13,6 +13,4 @@ then
exit 1
fi

dotnet tool restore

dotnet csharpier . --check
dotnet tool restore && dotnet csharpier . --check
6 changes: 4 additions & 2 deletions Src/ViaCep/ViaCepClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ CancellationToken cancellationToken
.GetAsync($"/ws/{zipCode}/json", cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();
return await response.Content
return await response
.Content
.ReadAsAsync<ViaCepResult>(cancellationToken)
.ConfigureAwait(false);
}
Expand All @@ -110,7 +111,8 @@ CancellationToken cancellationToken
.GetAsync($"/ws/{stateInitials}/{city}/{address}/json", cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();
return await response.Content
return await response
.Content
.ReadAsAsync<List<ViaCepResult>>(cancellationToken)
.ConfigureAwait(false);
}
Expand Down
30 changes: 17 additions & 13 deletions Tests/ViaCep.Tests/AddressTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
{
using System;
using System.Linq;
using Xunit;
using Moq;
using System.Threading;
using System.Threading.Tasks;
using Moq;
using Xunit;

/// <summary>
/// The address tests class.
Expand All @@ -24,11 +24,13 @@ public void ValidateSearchByFullAddress()
.Setup(c => c.Search(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
.Returns(fixtureResults);

var results = clientMock.Object.Search(
fixtureResults.First().StateInitials,
fixtureResults.First().City,
fixtureResults.First().Street
);
var results = clientMock
.Object
.Search(
fixtureResults.First().StateInitials,
fixtureResults.First().City,
fixtureResults.First().Street
);
Assert.NotNull(results);

var list = results.ToList();
Expand Down Expand Up @@ -63,12 +65,14 @@ public async Task ValidateSearchByFullAddressAsync()
)
.ReturnsAsync(fixtureResults);

var results = await clientMock.Object.SearchAsync(
fixtureResults.First().StateInitials,
fixtureResults.First().City,
fixtureResults.First().Street,
CancellationToken.None
);
var results = await clientMock
.Object
.SearchAsync(
fixtureResults.First().StateInitials,
fixtureResults.First().City,
fixtureResults.First().Street,
CancellationToken.None
);
Assert.NotNull(results);

var list = results.ToList();
Expand Down
2 changes: 1 addition & 1 deletion Tests/ViaCep.Tests/ZipCodeTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace ViaCep.Tests
{
using Moq;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Moq;
using Xunit;

/// <summary>
Expand Down

0 comments on commit d4a3b2d

Please sign in to comment.