Skip to content

Commit

Permalink
- code linting
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <[email protected]>
  • Loading branch information
baywet committed Oct 27, 2023
1 parent 4f1c7a8 commit 5d429e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/serialization/DeserializationHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private static ParsableFactory<T> GetFactoryFromType<T>() where T : IParsable
#endif
{
var type = typeof(T);
var factoryMethod = type.GetMethods().Where(static x => x.IsStatic && "CreateFromDiscriminatorValue".Equals(x.Name, StringComparison.OrdinalIgnoreCase)).FirstOrDefault() ??
var factoryMethod = type.GetMethods().FirstOrDefault(static x => x.IsStatic && "CreateFromDiscriminatorValue".Equals(x.Name, StringComparison.OrdinalIgnoreCase)) ??

Check warning on line 75 in src/serialization/DeserializationHelpers.cs

View workflow job for this annotation

GitHub Actions / Build

"Find" method should be used instead of the "FirstOrDefault" extension method. (https://rules.sonarsource.com/csharp/RSPEC-6602)
throw new InvalidOperationException($"No factory method found for type {type.Name}");
return (ParsableFactory<T>)factoryMethod.CreateDelegate(typeof(ParsableFactory<T>));
}
Expand Down
2 changes: 1 addition & 1 deletion src/serialization/JsonDeserializationHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.Kiota.Abstractions.Serialization;
/// <summary>
/// Set of helper methods for JSON serialization
/// </summary>
public class JsonDeserializationHelpers
public static class JsonDeserializationHelpers
{
private const string _jsonContentType = "application/json";
/// <summary>
Expand Down

0 comments on commit 5d429e7

Please sign in to comment.