Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

Commit

Permalink
Suppressing SA1127 SA1128 (:base, where T)
Browse files Browse the repository at this point in the history
  • Loading branch information
xrem committed Jan 4, 2023
1 parent 9c1ed23 commit f62e9e1
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<AnalysisLevel>latest</AnalysisLevel>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>1591;SA1633;SA1101;SA1503;SA1309;SA1601;SA1201;SA1502</NoWarn>
<NoWarn>1591;SA1633;SA1101;SA1503;SA1309;SA1601;SA1201;SA1502;SA1127;SA1128</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ namespace Kysect.Shreks.Common.Exceptions;

public class RegistrationFailedException : ShreksDomainException
{
public RegistrationFailedException(string? message)
: base(message) { }
public RegistrationFailedException(string? message) : base(message) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ public abstract class ShreksDomainException : Exception
{
protected ShreksDomainException() { }

protected ShreksDomainException(string? message)
: base(message) { }
protected ShreksDomainException(string? message) : base(message) { }

protected ShreksDomainException(string? message, Exception? innerException)
: base(message, innerException) { }
protected ShreksDomainException(string? message, Exception? innerException) : base(message, innerException) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ namespace Kysect.Shreks.Common.Exceptions;

public class StudentAssignmentException : ShreksDomainException
{
private StudentAssignmentException(string message)
: base(message) { }
private StudentAssignmentException(string message) : base(message) { }

public static StudentAssignmentException StudentGroupAssignmentMismatch(string student, string group)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ namespace Kysect.Shreks.Common.Exceptions;

public class UnauthorizedException : ShreksDomainException
{
public UnauthorizedException(string? message)
: base(message) { }
public UnauthorizedException(string? message) : base(message) { }

public UnauthorizedException()
: base(UserMessages.UnauthorizedExceptionMessage) { }
Expand Down
6 changes: 2 additions & 4 deletions Source/Domain/Kysect.Shreks.Core/Users/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@ public void RemoveAssociation(UserAssociation association)
throw new DomainInvalidOperationException($"User {this} could not remove association {association}");
}

public bool HasAssociation<T>()
where T : UserAssociation
public bool HasAssociation<T>() where T : UserAssociation
{
return Associations.Any(a => a is T);
}

public T? FindAssociation<T>()
where T : UserAssociation
public T? FindAssociation<T>() where T : UserAssociation
{
return Associations.OfType<T>().SingleOrDefault();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace Kysect.Shreks.Controllers;

public interface IControllersProjectMarker { }
public interface IControllerProjectMarker { }
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AnalysisLevel>latest</AnalysisLevel>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<NoWarn>1701;1702;CA1062;SA1101;SA1309;SA1633;SA1503</NoWarn>
<NoWarn>1701;1702;CA1062;SA1101;SA1309;SA1633;SA1503;SA1127;SA1128;SA1502</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace Kysect.Shreks.WebUI.AdminPanel.SafeExecution;

public class ExceptionHandler<T> : IExceptionHandler
where T : Exception
public class ExceptionHandler<T> : IExceptionHandler where T : Exception
{
private readonly Func<T, Task> _handler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ public interface ISafeExecutionBuilder : IAsyncDisposable

bool ShowExceptionDetails { get; set; }

void OnFailAsync<TException>(Func<TException, Task> action)
where TException : Exception;
void OnFailAsync<TException>(Func<TException, Task> action) where TException : Exception;

void OnSuccessAsync(Func<Task> action);
}
Expand All @@ -18,8 +17,7 @@ public interface ISafeExecutionBuilder<out T> : IAsyncDisposable

bool ShowExceptionDetails { get; set; }

void OnFailAsync<TException>(Func<TException, Task> action)
where TException : Exception;
void OnFailAsync<TException>(Func<TException, Task> action) where TException : Exception;

void OnSuccessAsync(Func<T, Task> action);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public SafeExecutionBuilder(

public bool ShowExceptionDetails { get; set; }

public void OnFailAsync<TException>(Func<TException, Task> action)
where TException : Exception
public void OnFailAsync<TException>(Func<TException, Task> action) where TException : Exception
{
_errorHandlers.Add(new ExceptionHandler<TException>(action));
}
Expand Down Expand Up @@ -107,8 +106,7 @@ public SafeExecutionBuilder(

public bool ShowExceptionDetails { get; set; }

public void OnFailAsync<TException>(Func<TException, Task> action)
where TException : Exception
public void OnFailAsync<TException>(Func<TException, Task> action) where TException : Exception
{
_errorHandlers.Add(new ExceptionHandler<TException>(action));
}
Expand Down

0 comments on commit f62e9e1

Please sign in to comment.