Skip to content

Commit

Permalink
VCI-821: Fix codesmells
Browse files Browse the repository at this point in the history
  • Loading branch information
krankenbro committed Mar 7, 2024
1 parent 479a382 commit eae403e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/VirtoCommerce.Build/PlatformTools/Build.PackageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ private static async Task<ManifestBase> OpenOrCreateManifest(string packageManif
else if (!File.Exists(packageManifestPath) && File.Exists(platformWebDllPath))
{
var discoveryAbsolutePath = Path.GetFullPath(GetDiscoveryPath());
return CreateManifestFromEnvironment(RootDirectory, discoveryAbsolutePath.ToAbsolutePath());
return await CreateManifestFromEnvironment(RootDirectory, discoveryAbsolutePath.ToAbsolutePath());
}
else if (!File.Exists(packageManifestPath))
{
Expand Down Expand Up @@ -644,7 +644,7 @@ private static async Task DownloadBundleManifest(string bundleName, string outFi
await HttpTasks.HttpDownloadFileAsync(manifestUrl, outFile.ToAbsolutePath());
}

private static ManifestBase CreateManifestFromEnvironment(AbsolutePath platformPath, AbsolutePath discoveryPath)
private async static Task<ManifestBase> CreateManifestFromEnvironment(AbsolutePath platformPath, AbsolutePath discoveryPath)
{
var platformWebDllPath = platformPath / "VirtoCommerce.Platform.Web.dll";
if (!File.Exists(platformWebDllPath))
Expand All @@ -657,7 +657,7 @@ private static ManifestBase CreateManifestFromEnvironment(AbsolutePath platformP
var githubModules = PackageManager.GetGithubModules(packageManifest);
var githubModulesSource = PackageManager.GetGithubModulesSource(packageManifest);
var localModuleCatalog = (LocalCatalog)LocalModuleCatalog.GetCatalog(GetDiscoveryPath(), ProbingPath);
var externalModuleCatalog = ExtModuleCatalog.GetCatalog(GitHubToken, localModuleCatalog, githubModulesSource.ModuleSources).GetAwaiter().GetResult();
var externalModuleCatalog = await ExtModuleCatalog.GetCatalog(GitHubToken, localModuleCatalog, githubModulesSource.ModuleSources);
var modulesInCatalog = externalModuleCatalog.Modules.Where(m => !m.Ref.StartsWith("file://")).Select(m => m.ModuleName).ToList();
var manifests = discoveryPath.GlobFiles("*/module.manifest");
manifests.ForEach(m =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Stream OpenRead(Uri address)
}
finally
{
client?.Dispose();
client.Dispose();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ protected override async Task InnerInstall(ModuleSource source, IProgress<Progre
progress.ReportError($"{module.Id}:{module.Version} is not found");
continue;
}
var asset = release.Assets.FirstOrDefault();
if (asset == null)

if (release.Assets.Count == 0)
{
progress.ReportError($"{module.Id}:{module.Version} has no assets");
continue;
}
var asset = release.Assets[0];

progress.ReportInfo($"Downloading {module.Id}");
await HttpTasks.HttpDownloadFileAsync(asset.Url, zipDestination, clientConfigurator: c =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private static string GetFileAbsoluteUri(string rootPath, string relativePath)
return builder.Uri.ToString();
}

private IDictionary<string, ModuleManifest> GetModuleManifests()
private Dictionary<string, ModuleManifest> GetModuleManifests()
{
var result = new Dictionary<string, ModuleManifest>();

Expand Down

0 comments on commit eae403e

Please sign in to comment.