Showing 35 of 59 total issues
File FilesController.cs
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
using System.Net.Mime;using System.Security.Claims;using System.Text.Json;using Microsoft.AspNetCore.Authorization;using Microsoft.AspNetCore.Http;
Method OnGet
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async Task<ActionResult> OnGet(CancellationToken cancellationToken = default) { ViewData["Title"] = "Welcome to WOPI HOST test page"; try {
Method HandleLockOrPut
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private IActionResult HandleLockOrPut(string id, string? oldLockIdentifier, string? newLockIdentifier, bool lockAcquired, WopiLockInfo? existingLock) { ArgumentNullException.ThrowIfNull(lockProvider); if (oldLockIdentifier is null) {
Method HandleLockOrPut
has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring. Open
Open
private IActionResult HandleLockOrPut(string id, string? oldLockIdentifier, string? newLockIdentifier, bool lockAcquired, WopiLockInfo? existingLock) { ArgumentNullException.ThrowIfNull(lockProvider); if (oldLockIdentifier is null) {
- Read upRead up
Method GetRootContainer
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[HttpPost] [Produces(MediaTypeNames.Application.Json)] public async Task<IActionResult> GetRootContainer( [FromHeader(Name = WopiHeaders.ECOSYSTEM_OPERATION)] string? ecosystemOperation = null, [FromHeader(Name = WopiHeaders.WOPI_SRC)] string? wopiSrc = null,
Method HandleAuthenticateAsync
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected override async Task<AuthenticateResult> HandleAuthenticateAsync() { try { //TODO: implement access_token_ttl https://learn.microsoft.com/openspecs/office_protocols/ms-wopi/adb48ba9-118a-43b6-82d7-9a508aad1583
Method GetCobaltFile
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task<CobaltFile> GetCobaltFile(IWopiFile file, ClaimsPrincipal principal) { var disposal = new DisposalEscrow(file.Owner); var content = new CobaltFilePartitionConfig {
Method CreateChildContainer
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[HttpPost("{id}")] [Produces(MediaTypeNames.Application.Json)] [WopiOverrideHeader(WopiContainerOperations.CreateChildContainer)] [WopiAuthorize(WopiResourceType.Container, Permission.Create)] public async Task<IActionResult> CreateChildContainer(
Method GetWopiCheckFileInfo
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static WopiCheckFileInfo GetWopiCheckFileInfo(this IWopiFile file, WopiHostCapabilities? capabilities = null) { // #181 make sure the BaseFileName always has an extensions var baseFileName = file.Name.EndsWith(file.Extension, StringComparison.OrdinalIgnoreCase) ? file.Name
Method RenameContainer
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[HttpPost("{id}")] [Produces(MediaTypeNames.Application.Json)] [WopiOverrideHeader(WopiContainerOperations.RenameContainer)] [WopiAuthorize(WopiResourceType.Container, Permission.Rename)] public async Task<IActionResult> RenameContainer(
Method BuildCheckFileInfo
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task<WopiCheckFileInfo> BuildCheckFileInfo( IWopiFile file, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(file);
Method HandleUnlock
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private IActionResult HandleUnlock(string id, string? newLockIdentifier, bool lockAcquired, WopiLockInfo? existingLock) { ArgumentNullException.ThrowIfNull(lockProvider); if (lockAcquired)
Method ExecuteResultAsync
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public override async Task ExecuteResultAsync(ActionContext context) { var response = context.HttpContext.Response; response.ContentType = ContentType; var targetStream = response.Body;
Method OnGetWopiCheckFileInfo
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static Task<WopiCheckFileInfo> OnGetWopiCheckFileInfo(WopiCheckFileInfoContext context) { var wopiCheckFileInfo = context.CheckFileInfo; wopiCheckFileInfo.AllowAdditionalMicrosoftServices = true; wopiCheckFileInfo.AllowErrorReportPrompt = true;
Method Index
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async Task<ActionResult> Index() { ViewData["Title"] = "Welcome to WOPI HOST test page"; try {
Method DeleteContainer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[HttpPost("{id}")] [WopiOverrideHeader(WopiContainerOperations.DeleteContainer)] [WopiAuthorize(WopiResourceType.Container, Permission.Delete)] public async Task<IActionResult> DeleteContainer(string id, CancellationToken cancellationToken = default) {
Method PutFile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[HttpPut("{id}/contents")] [HttpPost("{id}/contents")] [WopiAuthorize(WopiResourceType.File, Permission.Update)] public async Task<IActionResult> PutFile( string id,
Method HandleLockOrPut
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private IActionResult HandleLockOrPut(string id, string? oldLockIdentifier, string? newLockIdentifier, bool lockAcquired, WopiLockInfo? existingLock)
Avoid too many return
statements within this method. Open
Open
return new ConflictResult();
Avoid too many return
statements within this method. Open
Open
return new LockMismatchResult(Response, reason: "Missing new lock identifier");