Resolved more warnings, and marked more warning types as errors (#16990)
* Fix warnings SA1111, SA1028, SA1500, IDE1270 in Umbraco.Web.Website, and updated rules. * Remove warnings: IDE0270: Null check can be simplified * More SqlServer project warnings resolved * CS0105 namespace appeared already * Suppress warning until implementation: #pragma warning disable CS0162 // Unreachable code detected #pragma warning disable CS0618 // Type or member is obsolete CS0162 remove unreachable code SA1028 remove trailing whitespace SA1106 no empty statements CS1570 malformed XML CS1572 corrected xml parameter CS1573 param tag added IDE0007 var not explicit IDE0008 explicit not var IDE0057 simplify substring IDE0074 compound assignment CA1825 array.empty Down to 3479 warnings
This commit is contained in:
@@ -57,8 +57,7 @@ public static partial class UmbracoBuilderExtensions
|
||||
x.GetRequiredService<IControllerActionSearcher>(),
|
||||
x.GetRequiredService<IPublicAccessRequestHandler>(),
|
||||
x.GetRequiredService<IUmbracoVirtualPageRoute>(),
|
||||
x.GetRequiredService<IOptionsMonitor<GlobalSettings>>()
|
||||
));
|
||||
x.GetRequiredService<IOptionsMonitor<GlobalSettings>>()));
|
||||
builder.Services.AddSingleton<IControllerActionSearcher, ControllerActionSearcher>();
|
||||
builder.Services.TryAddEnumerable(Singleton<MatcherPolicy, NotFoundSelectorPolicy>());
|
||||
builder.Services.AddSingleton<IUmbracoVirtualPageRoute, UmbracoVirtualPageRoute>();
|
||||
|
||||
@@ -148,9 +148,10 @@ public class PublicAccessRequestHandler : IPublicAccessRequestHandler
|
||||
_logger.LogDebug("EnsurePublishedContentAccess: Page is not protected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// loop until we have access or reached max loops
|
||||
} while (publicAccessStatus != PublicAccessStatus.AccessAccepted && i++ < maxLoop);
|
||||
// loop until we have access or reached max loops
|
||||
while (publicAccessStatus != PublicAccessStatus.AccessAccepted && i++ < maxLoop);
|
||||
|
||||
if (i == maxLoop)
|
||||
{
|
||||
|
||||
@@ -45,13 +45,8 @@ public class UmbracoRouteValuesFactory : IUmbracoRouteValuesFactory
|
||||
ControllerActionDescriptor? descriptor = _controllerActionSearcher.Find<IRenderController>(
|
||||
new DefaultHttpContext(), // this actually makes no difference for this method
|
||||
DefaultControllerName,
|
||||
UmbracoRouteValues.DefaultActionName);
|
||||
|
||||
if (descriptor == null)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
UmbracoRouteValues.DefaultActionName) ?? throw new InvalidOperationException(
|
||||
$"No controller/action found by name {DefaultControllerName}.{UmbracoRouteValues.DefaultActionName}");
|
||||
}
|
||||
|
||||
return descriptor;
|
||||
});
|
||||
@@ -151,8 +146,8 @@ public class UmbracoRouteValuesFactory : IUmbracoRouteValuesFactory
|
||||
$"The call to {nameof(IPublishedRouter.UpdateRequestAsync)} cannot return null");
|
||||
}
|
||||
|
||||
string? customActionName = GetTemplateName(request);
|
||||
|
||||
string? customActionName = GetTemplateName(request);
|
||||
|
||||
def = new UmbracoRouteValues(
|
||||
request,
|
||||
def.ControllerActionDescriptor,
|
||||
@@ -167,7 +162,7 @@ public class UmbracoRouteValuesFactory : IUmbracoRouteValuesFactory
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
|
||||
private string? GetTemplateName(IPublishedRequest request)
|
||||
{
|
||||
// check that a template is defined), if it doesn't and there is a hijacked route it will just route
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
<RootNamespace>Umbraco.Cms.Web.Website</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<!-- TODO: Fix all warnings and remove this override -->
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<!-- TODO: [ASP0019] use IHeaderDictionary.Append or the indexer to append or set headers,
|
||||
[CS0618] handle member obsolete appropriately, [SA1401] make fields private,
|
||||
[SA1649] update file name, and remove this override, [IDE1006] fix namin rule violation,
|
||||
and remove override -->
|
||||
<WarningsNotAsErrors>ASP0019,CS0618,SA1401,SA1649,IDE0270,IDE1006</WarningsNotAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Web.Common\Umbraco.Web.Common.csproj" />
|
||||
|
||||
@@ -8,6 +8,8 @@ public class ProfilingViewEngine : IViewEngine
|
||||
{
|
||||
private readonly string _name;
|
||||
private readonly IProfiler _profiler;
|
||||
|
||||
//TODO: can this be made private and with underscore?
|
||||
internal readonly IViewEngine Inner;
|
||||
|
||||
public ProfilingViewEngine(IViewEngine inner, IProfiler profiler)
|
||||
|
||||
Reference in New Issue
Block a user