Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump csharpier from 0.26.7 to 0.27.0 #289

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.26.7",
"version": "0.27.0",
"commands": [
"dotnet-csharpier"
]
Expand Down
20 changes: 8 additions & 12 deletions Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
indexName = GetIndexName<T>();
}

_connector.Client.Indices.BulkAlias(
a => a.Add(add => add.Index(indexName).Alias(alias))
_connector.Client.Indices.BulkAlias(a =>

Check warning on line 67 in Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs#L67

Added line #L67 was not covered by tests
a.Add(add => add.Index(indexName).Alias(alias))
);
return index;
}
Expand Down Expand Up @@ -126,17 +126,13 @@
)
where T : class, new()
{
var result = _connector.Client.DeleteByQuery<T>(
d =>
d.Index(indexPattern)
.Query(
q =>
q.DateRange(
g =>
g.Field(field)
.LessThan(DateMath.Now.Subtract($@"{daysBefore}d"))
)
var result = _connector.Client.DeleteByQuery<T>(d =>

Check warning on line 129 in Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs#L129

Added line #L129 was not covered by tests
d.Index(indexPattern)
.Query(q =>

Check warning on line 131 in Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs#L131

Added line #L131 was not covered by tests
q.DateRange(g =>
g.Field(field).LessThan(DateMath.Now.Subtract($@"{daysBefore}d"))

Check warning on line 133 in Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs#L133

Added line #L133 was not covered by tests
)
)

Check warning on line 135 in Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle.ElasticSearch/Helpers/Extensions.cs#L135

Added line #L135 was not covered by tests
);

return result.Deleted;
Expand Down
17 changes: 7 additions & 10 deletions Src/CrispyWaffle.ElasticSearch/Log/ElasticSearchLogProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,14 @@
}

var retentionDays = _logRetentionDays;
_client.DeleteByQuery<LogMessage>(
d =>
d.Index(_indexName)
.Query(
q =>
q.DateRange(
g =>
g.Field(f => f.Date)
.LessThan(DateMath.Now.Subtract($@"{retentionDays}d"))
)
_client.DeleteByQuery<LogMessage>(d =>

Check warning on line 107 in Src/CrispyWaffle.ElasticSearch/Log/ElasticSearchLogProvider.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle.ElasticSearch/Log/ElasticSearchLogProvider.cs#L107

Added line #L107 was not covered by tests
d.Index(_indexName)
.Query(q =>

Check warning on line 109 in Src/CrispyWaffle.ElasticSearch/Log/ElasticSearchLogProvider.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle.ElasticSearch/Log/ElasticSearchLogProvider.cs#L109

Added line #L109 was not covered by tests
q.DateRange(g =>
g.Field(f => f.Date)
.LessThan(DateMath.Now.Subtract($@"{retentionDays}d"))

Check warning on line 112 in Src/CrispyWaffle.ElasticSearch/Log/ElasticSearchLogProvider.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle.ElasticSearch/Log/ElasticSearchLogProvider.cs#L111-L112

Added lines #L111 - L112 were not covered by tests
)
)

Check warning on line 114 in Src/CrispyWaffle.ElasticSearch/Log/ElasticSearchLogProvider.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle.ElasticSearch/Log/ElasticSearchLogProvider.cs#L114

Added line #L114 was not covered by tests
);
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions Src/CrispyWaffle.Elmah/ElmahExceptionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ private void HandleInternal(Exception exception)
);

foreach (
var additionalProvider in _additionalProviders.Where(
p => p.Item2 == ExceptionLogType.Full
var additionalProvider in _additionalProviders.Where(p =>
p.Item2 == ExceptionLogType.Full
)
)
{
Expand Down
69 changes: 29 additions & 40 deletions Src/CrispyWaffle/Composition/ServiceLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@
TypesCache = AppDomain
.CurrentDomain.GetAssemblies()
.SelectMany(a => a.GetTypes())
.Where(
a =>
a != null
&& a.Name.IndexOf(@"_canon", StringComparison.InvariantCultureIgnoreCase)
== -1
.Where(a =>
a != null
&& a.Name.IndexOf(@"_canon", StringComparison.InvariantCultureIgnoreCase) == -1
)
.ToList();
var cancellationToken = typeof(CancellationToken);
Expand Down Expand Up @@ -526,13 +524,9 @@
)
{
var candidates = constructors
.Where(
c =>
c.GetParameters()
.All(
p =>
!p.ParameterType.IsSimpleType() && p.ParameterType != parentType
)
.Where(c =>
c.GetParameters()
.All(p => !p.ParameterType.IsSimpleType() && p.ParameterType != parentType)
)
.ToList();

Expand All @@ -545,22 +539,20 @@
default:
return candidates
.OrderByDescending(c => c.GetParameters().Length)
.First(
c =>
c.GetParameters()
.Select((p, i) => new { p.ParameterType, Index = i })
.All(
p =>
(
parentType == null
? GetInstance(p.ParameterType)
: GetInstanceWithContext(
p.ParameterType,
parentType,
p.Index
)
) != null
)
.First(c =>
c.GetParameters()
.Select((p, i) => new { p.ParameterType, Index = i })
.All(p =>
(
parentType == null
? GetInstance(p.ParameterType)
: GetInstanceWithContext(
p.ParameterType,
parentType,
p.Index
)
) != null
)
);
}
}
Expand All @@ -574,11 +566,10 @@
private static object TryAutoRegistration(Type type)
{
var types = TypesCache
.Where(
t =>
!t.IsAbstract
&& type.IsAssignableFrom(t)
&& t.GetConstructors().Any(c => !c.GetParameters().Any())
.Where(t =>
!t.IsAbstract
&& type.IsAssignableFrom(t)
&& t.GetConstructors().Any(c => !c.GetParameters().Any())
)
.ToList();
if (types.Count == 0)
Expand Down Expand Up @@ -713,13 +704,11 @@
var type = typeof(IDisposable);
var instances = _registrationsCalls
.Where(call => call.Value > 0)
.SelectMany(
call =>
_registrations.Where(
implementation =>
type.IsAssignableFrom(implementation.Key)
&& call.Key.IsAssignableFrom(implementation.Key)
)
.SelectMany(call =>
_registrations.Where(implementation =>

Check warning on line 708 in Src/CrispyWaffle/Composition/ServiceLocator.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle/Composition/ServiceLocator.cs#L707-L708

Added lines #L707 - L708 were not covered by tests
type.IsAssignableFrom(implementation.Key)
&& call.Key.IsAssignableFrom(implementation.Key)
)

Check warning on line 711 in Src/CrispyWaffle/Composition/ServiceLocator.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle/Composition/ServiceLocator.cs#L710-L711

Added lines #L710 - L711 were not covered by tests
)
.ToList();

Expand Down
60 changes: 26 additions & 34 deletions Src/CrispyWaffle/Extensions/EnumExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,22 @@ public static T GetEnumByHumanReadableAttribute<T>(string humanReadableValue)
}

var field = type.GetFields()
.Select(
f =>
new
{
Field = f,
Attr = Attribute.GetCustomAttribute(f, typeof(HumanReadableAttribute))
as HumanReadableAttribute
}
)
.Where(
item =>
item.Attr != null
&& item.Attr.StringValue.Equals(
humanReadableValue,
StringComparison.OrdinalIgnoreCase
)
|| item.Field.Name.Equals(
.Select(f => new
{
Field = f,
Attr = Attribute.GetCustomAttribute(f, typeof(HumanReadableAttribute))
as HumanReadableAttribute
})
.Where(item =>
item.Attr != null
&& item.Attr.StringValue.Equals(
humanReadableValue,
StringComparison.OrdinalIgnoreCase
)
|| item.Field.Name.Equals(
humanReadableValue,
StringComparison.OrdinalIgnoreCase
)
)
.Select(item => item.Field)
.SingleOrDefault();
Expand Down Expand Up @@ -86,23 +82,19 @@ public static T GetEnumByInternalValueAttribute<T>(string internalValue)
}

var field = type.GetFields()
.Select(
f =>
new
{
Field = f,
Attr = Attribute.GetCustomAttribute(f, typeof(InternalValueAttribute))
as InternalValueAttribute
}
)
.Where(
item =>
item.Attr != null
&& item.Attr.InternalValue.Equals(
internalValue,
StringComparison.OrdinalIgnoreCase
)
|| item.Field.Name.Equals(internalValue, StringComparison.OrdinalIgnoreCase)
.Select(f => new
{
Field = f,
Attr = Attribute.GetCustomAttribute(f, typeof(InternalValueAttribute))
as InternalValueAttribute
})
.Where(item =>
item.Attr != null
&& item.Attr.InternalValue.Equals(
internalValue,
StringComparison.OrdinalIgnoreCase
)
|| item.Field.Name.Equals(internalValue, StringComparison.OrdinalIgnoreCase)
)
.Select(item => item.Field)
.SingleOrDefault();
Expand Down
4 changes: 2 additions & 2 deletions Src/CrispyWaffle/Log/Handlers/DefaultExceptionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
);

foreach (
var additionalProvider in _additionalProviders.Where(
p => p.Item2 == ExceptionLogType.Full
var additionalProvider in _additionalProviders.Where(p =>
p.Item2 == ExceptionLogType.Full

Check warning on line 125 in Src/CrispyWaffle/Log/Handlers/DefaultExceptionHandler.cs

View check run for this annotation

Codecov / codecov/patch

Src/CrispyWaffle/Log/Handlers/DefaultExceptionHandler.cs#L125

Added line #L125 was not covered by tests
)
)
{
Expand Down Expand Up @@ -214,7 +214,7 @@
}
catch (Exception)
{
//ignore handling

Check warning on line 217 in Src/CrispyWaffle/Log/Handlers/DefaultExceptionHandler.cs

View workflow job for this annotation

GitHub Actions / Deep Source Coverage report

}
}

Expand All @@ -236,7 +236,7 @@
}
catch (Exception)
{
//ignore handling

Check warning on line 239 in Src/CrispyWaffle/Log/Handlers/DefaultExceptionHandler.cs

View workflow job for this annotation

GitHub Actions / Deep Source Coverage report

}
}
}
Expand Down
Loading
Loading