files-community / Files

Building the best file manager for Windows
https://files.community
MIT License
34.04k stars 2.18k forks source link

Code Quality: Method has overload with cancellation support #15095

Open gumbarros opened 6 months ago

gumbarros commented 6 months ago

Description

Many methods in the code base supports cancellation and are nothing using the CancellationToken.

Concerned code

\\\Services\UpdateService.cs (1 issue) \\\Utils\Storage\Search\FolderSearch.cs (3 issues) \\\Utils\Archives\CompressArchiveModel.cs (1 issue) \\\Services\SideloadUpdateService.cs (1 issue) \\\Utils\Storage\StorageItems\VirtualStorageFile.cs (2 issues) \\\Utils\Storage\StorageItems\NativeStorageFile.cs (7 issues) \\\Utils\Storage\StorageItems\FtpStorageFolder.cs (5 issues) \\\Utils\Storage\Operations\FilesystemOperations.cs (29 issues) \\\Utils\Storage\StorageItems\SystemStorageFile.cs (8 issues) \\\Utils\Storage\StorageItems\ZipStorageFolder.cs (8 issues) \\\Utils\Storage\StorageItems\ZipStorageFile.cs (4 issues) \\\Utils\Storage\StorageBaseItems\BaseStorageFolder.cs (6 issues) \\\Utils\Storage\Operations\FileOperationsHelpers.cs (3 issues) \\\Data\Models\ItemViewModel.cs (5 issues) \\\Utils\Storage\StorageItems\FtpStorageFile.cs (1 issue) \\\Data\Factories\ShellContextFlyoutHelper.cs (1 issue) \\\Helpers\Win32\Win32Helper.Storage.cs (2 issues) \\\Utils\Git\GitHelpers.cs (3 issues) \\\Utils\Storage\StorageItems\StreamWithContentType.cs (2 issues) \\\ViewModels\Properties\Items\FolderProperties.cs (1 issue) \\\ViewModels\Properties\Items\LibraryProperties.cs (1 issue) ### Gains - Reliability, if the user cancels an operation, the operation will respond faster because of the `CancellationToken` ### Requirements - Passing the `CancellationToken ` in the methods specified by the analyzer ### Comments _No response_
0x5bfa commented 3 months ago

Beaches this is what I’ve also been thinking, I can fix some of them.