@@ -123,13 +123,13 @@ private async Task CheckShortDescription(CatalogYaml catalogYaml)
123
123
private async Task CheckTags ( CatalogYaml catalogYaml )
124
124
{
125
125
logger . LogDebug ( "Checking if Tags exist, extending with retrieved GitHub repository topics..." ) ;
126
- if ( catalogYaml . Tags == null || ! catalogYaml . Tags . Any ( ) )
126
+ if ( catalogYaml . Tags == null || catalogYaml . Tags . Count == 0 )
127
127
{
128
128
catalogYaml . Tags = new List < string > ( ) ;
129
129
}
130
130
131
131
var topics = await service . GetRepositoryTopicsAsync ( ) ;
132
- if ( topics != null && topics . Any ( ) )
132
+ if ( topics is { Count : > 0 } )
133
133
{
134
134
catalogYaml . Tags . AddRange ( topics ) ;
135
135
catalogYaml . Tags = catalogYaml . Tags . Distinct ( ) . ToList ( ) ;
@@ -250,18 +250,13 @@ private CatalogYaml CreateCatalogYaml(IDeserializer deserializer, out string fou
250
250
private static string InferArtifactContentType ( string keyword )
251
251
{
252
252
// Check if the keyword exists in the dictionary
253
- if ( ! Constants . ArtifactTypeMap . TryGetValue ( keyword . ToUpper ( ) , out var contentType ) )
253
+ if ( Constants . ArtifactTypeMap . TryGetValue ( keyword . ToUpper ( ) , out var contentType ) )
254
254
{
255
- foreach ( var typeName in Constants . ArtifactTypeMap . Values )
256
- {
257
- if ( typeName . Equals ( keyword , StringComparison . OrdinalIgnoreCase ) )
258
- {
259
- contentType = typeName ;
260
- }
261
- }
255
+ return contentType ;
262
256
}
263
257
264
- return contentType ?? String . Empty ;
258
+ return Constants . ArtifactTypeMap . FirstOrDefault ( pair => pair . Value . Equals ( keyword , StringComparison . OrdinalIgnoreCase ) ) . Key ??
259
+ String . Empty ;
265
260
}
266
261
267
262
/// <summary>
0 commit comments