Skip to content

Commit

Permalink
CodeQL warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r committed Jan 24, 2024
1 parent fe670de commit 35ac274
Showing 1 changed file with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,8 @@ private CacheEntry CreateCacheEntry(Type type)
.Where(o => o.Attribute != null)
.ToDictionary(o => o.pi, o => o.Attribute);

if (_options.IgnoreNullProperties && !optionalIgnoreAttributes.Any() && !destructuringAttributes.Any())
{
if (typeof(IEnumerable).IsAssignableFrom(type))
return CacheEntry.Ignore;
}
if (_options.IgnoreNullProperties && !optionalIgnoreAttributes.Any() && !destructuringAttributes.Any() && typeof(IEnumerable).IsAssignableFrom(type))
return CacheEntry.Ignore;

return new CacheEntry((o, f) => MakeStructure(o, properties, optionalIgnoreAttributes, destructuringAttributes, f, type));
}
Expand All @@ -93,17 +90,11 @@ private LogEventPropertyValue MakeStructure(
{
var propValue = SafeGetPropValue(o, pi);

if (optionalIgnoreAttributes.TryGetValue(pi, out var optionalIgnoreAttribute))
{
if (optionalIgnoreAttribute.ShouldPropertyBeIgnored(pi.Name, propValue, pi.PropertyType))
continue;
}
if (optionalIgnoreAttributes.TryGetValue(pi, out var optionalIgnoreAttribute) && optionalIgnoreAttribute.ShouldPropertyBeIgnored(pi.Name, propValue, pi.PropertyType))
continue;

if (_options.IgnoreNullProperties)
{
if (NotLoggedIfNullAttribute.Instance.ShouldPropertyBeIgnored(pi.Name, propValue, pi.PropertyType))
continue;
}
if (_options.IgnoreNullProperties && NotLoggedIfNullAttribute.Instance.ShouldPropertyBeIgnored(pi.Name, propValue, pi.PropertyType))
continue;

if (destructuringAttributes.TryGetValue(pi, out var destructuringAttribute))
{
Expand Down

0 comments on commit 35ac274

Please sign in to comment.