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

Address Code Style Violations #2102

Merged
merged 6 commits into from
Jun 5, 2023
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
1 change: 0 additions & 1 deletion benchmarks/Elastic.Apm.Benchmarks/Helpers/GitInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Elastic.Apm.Tests.Utilities;

namespace Elastic.Apm.Benchmarks.Helpers
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/Elastic.Apm.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// See the LICENSE file in the project root for more information

using System;
using System.Diagnostics;
using System.IO;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using Elastic.Apm.Benchmarks.Helpers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System;
using System.Reflection;
using BenchmarkDotNet.Attributes;
using Elastic.Apm.Helpers;
using Elastic.Apm.Reflection;
using Microsoft.Data.SqlClient;

Expand Down
4 changes: 2 additions & 2 deletions sample/ApiSamples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ public static void TwoTransactionWith2Spans()
Agent.Tracer.CaptureTransaction("TestTransaction1", "TestType1",
t =>
{
t.CaptureSpan("TestSpan", "TestSpanType", s =>
t.CaptureSpan("TestSpan", "TestSpanType", _ =>
{
Thread.Sleep(20);
//this span is also started on the transaction:
t.CaptureSpan("TestSpan2", "TestSpanType", s2 => { Thread.Sleep(20); });
t.CaptureSpan("TestSpan2", "TestSpanType", _ => { Thread.Sleep(20); });
});
});

Expand Down
2 changes: 0 additions & 2 deletions sample/Elastic.Apm.Azure.ServiceBus.Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ private static async Task ReadMessages()

Console.WriteLine("Printing messages:");
foreach (var item in messages)
{
Console.Write($"Body: {item.Body} - ");
}
Console.WriteLine($"Message count: {messages.Count}");
Console.WriteLine("Receiving messages from queue done");
}
Expand Down
2 changes: 1 addition & 1 deletion sample/ElasticsearchSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private static ConnectionSettings DefaultConnectionSettings(ConnectionSettings s
.DefaultIndex("index")
.DisableDirectStreaming();

private static async Task Main(string[] args)
private static async Task Main()
{
Agent.Subscribe(new ElasticsearchDiagnosticsSubscriber());

Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm.Specification/TypeValidationError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// See the LICENSE file in the project root for more information

using System;
using System.IO;

namespace Elastic.Apm.Specification
{
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm.Specification/Validator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using System.Threading.Tasks;
using Elastic.Apm.Api;
using Elastic.Apm.Api.Constraints;
using Elastic.Apm.Config;
using Elastic.Apm.Report.Serialization;
using ICSharpCode.SharpZipLib.Tar;
using Elastic.Apm.Libraries.Newtonsoft.Json.Serialization;
Expand Down
3 changes: 0 additions & 3 deletions src/Elastic.Apm/AgentComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using Elastic.Apm.Api;
using Elastic.Apm.BackendComm.CentralConfig;
using Elastic.Apm.Config;
Expand Down
2 changes: 0 additions & 2 deletions src/Elastic.Apm/Api/Http.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
// See the LICENSE file in the project root for more information

using System;
using System.Net.Http;
using Elastic.Apm.Api.Constraints;
using Elastic.Apm.Helpers;
using Elastic.Apm.Report.Serialization;
using Elastic.Apm.Libraries.Newtonsoft.Json;

namespace Elastic.Apm.Api
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm/Api/MetricSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System.Collections.Generic;
using Elastic.Apm.Helpers;
using Elastic.Apm.Libraries.Newtonsoft.Json;

namespace Elastic.Apm.Api
{
Expand Down
2 changes: 0 additions & 2 deletions src/Elastic.Apm/Api/Tracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Elastic.Apm.Config;
using Elastic.Apm.DistributedTracing;
using Elastic.Apm.Helpers;
using Elastic.Apm.Logging;
using Elastic.Apm.Metrics.MetricsProvider;
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm/ApmAgentExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System;
using System.Collections.Generic;
using System.Linq;
using Elastic.Apm.Api;
using Elastic.Apm.DiagnosticSource;

Expand Down
2 changes: 2 additions & 0 deletions src/Elastic.Apm/BackendComm/BackendCommUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
using System.Net.Http.Headers;
using System.Net.Security;
using System.Reflection;
#if NETSTANDARD2_0 || NET6_0_OR_GREATER
using System.Security.Authentication;
#endif
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.RegularExpressions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// See the LICENSE file in the project root for more information

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System;
using System.Collections.Generic;
using Elastic.Apm.Config;
using Elastic.Apm.Logging;
using static Elastic.Apm.BackendComm.CentralConfig.DynamicConfigurationOption;

namespace Elastic.Apm.BackendComm.CentralConfig
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm/Cloud/AwsCloudMetadataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Elastic.Apm.Api;
using Elastic.Apm.Logging;
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm/Cloud/AzureCloudMetadataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Elastic.Apm.Api;
using Elastic.Apm.Logging;
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm/Cloud/GcpCloudMetadataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Elastic.Apm.Api;
using Elastic.Apm.Logging;
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm/Config/ConfigConsts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Elastic.Apm.Cloud;
using Elastic.Apm.Helpers;
using Elastic.Apm.Logging;
using static Elastic.Apm.Config.ConfigurationOption;

namespace Elastic.Apm.Config
{
Expand Down
4 changes: 2 additions & 2 deletions src/Elastic.Apm/Config/ConfigurationLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static void PrintAgentLogPreamble(IApmLogger logger, IConfigurationReader
}
catch (Exception e)
{
logger?.Warning()?.LogException(e, $"Unexpected exception during {nameof(PrintAgentLogPreamble)}");
logger.Warning()?.LogException(e, $"Unexpected exception during {nameof(PrintAgentLogPreamble)}");
}
}

Expand Down Expand Up @@ -111,7 +111,7 @@ public static void PrintAgentConfiguration(IApmLogger logger, IConfigurationRead
}
catch (Exception e)
{
logger?.Warning()?.LogException(e, $"Unexpected exception during {nameof(PrintAgentConfiguration)}");
logger.Warning()?.LogException(e, $"Unexpected exception during {nameof(PrintAgentConfiguration)}");
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/Elastic.Apm/Config/EnvironmentConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System;
using System.Collections.Generic;
using System.Linq;
using Elastic.Apm.Helpers;
using Elastic.Apm.Logging;
using static Elastic.Apm.Config.ConfigConsts;

namespace Elastic.Apm.Config
{
Expand Down
2 changes: 0 additions & 2 deletions src/Elastic.Apm/Config/IConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.Runtime.CompilerServices;

namespace Elastic.Apm.Config
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// See the LICENSE file in the project root for more information

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;

namespace Elastic.Apm.DiagnosticListeners
Expand Down
2 changes: 2 additions & 0 deletions src/Elastic.Apm/DistributedTracing/TraceState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
using System;
using System.Collections.Generic;
using System.Globalization;
#if NETSTANDARD2_0 || NETFRAMEWORK
using System.Linq;
#endif
using System.Text;
using System.Threading;

Expand Down
2 changes: 2 additions & 0 deletions src/Elastic.Apm/Extensions/ListExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ internal static class ListExtensions
public static bool ContainsLike(this List<string> list, string matchedString)
{
foreach (var str in list)
{
if (str.IsLike(matchedString))
return true;
}

return false;
}
Expand Down
2 changes: 0 additions & 2 deletions src/Elastic.Apm/Helpers/CollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;

namespace Elastic.Apm.Helpers
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm/Helpers/ExceptionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Elastic.Apm.Logging;

namespace Elastic.Apm.Helpers
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm/Helpers/SystemInfoHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
using Elastic.Apm.Api;
using Elastic.Apm.Api.Kubernetes;
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm/ICurrentExecutionSegmentsContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information

using Elastic.Apm.Api;
using Elastic.Apm.Model;

namespace Elastic.Apm
{
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.Apm/Libraries/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dotnet_diagnostic.CS8625.severity = none
dotnet_diagnostic.CS8618.severity = none
dotnet_diagnostic.CS8620.severity = none
dotnet_diagnostic.CS8762.severity = none

generated_code = true

csharp_style_var_for_built_in_types = false:none
csharp_style_var_when_type_is_apparent = false:none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
using System.Globalization;
using Elastic.Apm.Libraries.Newtonsoft.Json.Utilities;
using System.Collections.Generic;
using System.Diagnostics;
#if HAVE_ADO_NET
using System.Data.SqlTypes;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
using Elastic.Apm.Libraries.Newtonsoft.Json.Serialization;
using System.Globalization;
using Elastic.Apm.Libraries.Newtonsoft.Json.Utilities;
using System.Diagnostics;

#nullable enable
namespace Elastic.Apm.Libraries.Newtonsoft.Json.Converters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
using System.Collections.Generic;
using System.Dynamic;
using System.Globalization;
using System.Linq;
using System.Text;
using Elastic.Apm.Libraries.Newtonsoft.Json.Utilities;

#nullable enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#if !HAVE_LINQ

#else
using System.Linq;

#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
using System.Threading.Tasks;
using Elastic.Apm.Libraries.Newtonsoft.Json.Serialization;
using Elastic.Apm.Libraries.Newtonsoft.Json.Utilities;
using System.Diagnostics;

#nullable enable
namespace Elastic.Apm.Libraries.Newtonsoft.Json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#endif
using System.Threading.Tasks;
using Elastic.Apm.Libraries.Newtonsoft.Json.Utilities;
using System.Diagnostics;

#nullable enable
namespace Elastic.Apm.Libraries.Newtonsoft.Json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#if HAVE_ASYNC
using System;
using System.Diagnostics;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#if !HAVE_LINQ

#else
using System.Linq;
#endif

#nullable enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#endregion

#if HAVE_ASYNC
using System;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Apm/Libraries/Newtonsoft.Json/Linq/JObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#endregion

#if HAVE_INOTIFY_COLLECTION_CHANGED
using System.Collections.ObjectModel;
using System.Collections.Specialized;
#endif
#if HAVE_DYNAMIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#endregion

#if HAVE_CONCURRENT_DICTIONARY
using System.Collections.Concurrent;
#endif
#if HAVE_DYNAMIC
using System.Dynamic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#if !HAVE_LINQ

#else
using System.Linq;

#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#if !HAVE_LINQ

#else
using System.Linq;

#endif

Expand Down
Loading
Loading