Skip to content

Commit

Permalink
Code quality fix InconsistentNaming
Browse files Browse the repository at this point in the history
  • Loading branch information
jayendranarumugam committed Dec 1, 2024
1 parent 120ead4 commit 2a96594
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ namespace Promitor.Agents.Scraper.Discovery
{
public class StubResourceDiscoveryRepository : IResourceDiscoveryRepository
{
private static readonly List<AzureResourceDefinition> emptyResourceDefinitions = new();
private static readonly AgentHealthReport healthReport = new();
private static readonly List<AzureResourceDefinition> EmptyResourceDefinitions = new();
private static readonly AgentHealthReport HealthReport = new();

public Task<List<AzureResourceDefinition>> GetResourceDiscoveryGroupAsync(string resourceDiscoveryGroupName)
{
return Task.FromResult(emptyResourceDefinitions);
return Task.FromResult(EmptyResourceDefinitions);
}

public Task<AgentHealthReport> GetHealthAsync()
{
return Task.FromResult(healthReport);
return Task.FromResult(HealthReport);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Core
{
public class AggregationDeserializer : Deserializer<AggregationV1>
{
private static readonly TimeSpan defaultAggregationInterval = TimeSpan.FromMinutes(5);
private static readonly TimeSpan DefaultAggregationInterval = TimeSpan.FromMinutes(5);

public AggregationDeserializer(ILogger<AggregationDeserializer> logger) : base(logger)
{
Map(aggregation => aggregation.Interval)
.WithDefault(defaultAggregationInterval);
.WithDefault(DefaultAggregationInterval);
}
}
}
4 changes: 2 additions & 2 deletions src/Promitor.Core/Serialization/Yaml/YamlSerialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ namespace Promitor.Core.Serialization.Yaml
{
public static class YamlSerialization
{
private static readonly INamingConvention namingConvention = CamelCaseNamingConvention.Instance;
private static readonly INamingConvention NamingConvention = CamelCaseNamingConvention.Instance;

public static ISerializer CreateSerializer()
{
var builder = new SerializerBuilder();
builder.WithNamingConvention(namingConvention);
builder.WithNamingConvention(NamingConvention);
builder.ConfigureDefaultValuesHandling(DefaultValuesHandling.OmitDefaults);

return builder.Build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Promitor.Integrations.Sinks.OpenTelemetry
public class OpenTelemetryCollectorMetricSink : MetricSink, IMetricSink
{
private readonly ILogger<OpenTelemetryCollectorMetricSink> _logger;
private static readonly Meter azureMonitorMeter = new Meter("Promitor.Scraper.Metrics.AzureMonitor", "1.0");
private static readonly Meter AzureMonitorMeter = new Meter("Promitor.Scraper.Metrics.AzureMonitor", "1.0");

public MetricSinkType Type => MetricSinkType.OpenTelemetryCollector;

Expand Down Expand Up @@ -74,7 +74,7 @@ public Task ReportMetricAsync(string metricName, string metricDescription, doubl

private void InitializeNewMetric(string metricName, string metricDescription)
{
var gauge = azureMonitorMeter.CreateObservableGauge<double>(metricName, description: metricDescription, observeValues: () => ReportMeasurementsForMetric(metricName));
var gauge = AzureMonitorMeter.CreateObservableGauge<double>(metricName, description: metricDescription, observeValues: () => ReportMeasurementsForMetric(metricName));
_gauges.TryAdd(metricName, gauge);

_measurements.TryAdd(metricName, []);
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/Promitor.Tests.Unit/Generators/ScrapeResultGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ namespace Promitor.Tests.Unit.Generators
{
public class ScrapeResultGenerator
{
private static readonly Faker bogus = new();
private static readonly Faker Bogus = new();

public static ScrapeResult GenerateFromMetric(MeasuredMetric measuredMetric)
{
var subscriptionId = bogus.Name.FirstName();
var resourceGroupName = bogus.Name.FirstName();
var instanceName = bogus.Name.FirstName();
var resourceUri = bogus.Internet.Url();
var subscriptionId = Bogus.Name.FirstName();
var resourceGroupName = Bogus.Name.FirstName();
var instanceName = Bogus.Name.FirstName();
var resourceUri = Bogus.Internet.Url();

return new ScrapeResult(subscriptionId, resourceGroupName, instanceName, resourceUri, new List<MeasuredMetric> {measuredMetric});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Promitor.Tests.Unit.Serialization.DeserializerTests
{
public class DeserializationTests : UnitTest
{
private static readonly TimeSpan defaultInterval = TimeSpan.FromMinutes(5);
private static readonly TimeSpan DefaultInterval = TimeSpan.FromMinutes(5);

private readonly Mock<IErrorReporter> _errorReporter = new();
private readonly Mock<IDeserializer<object>> _childDeserializer = new();
Expand Down Expand Up @@ -171,7 +171,7 @@ public void Deserialize_MapOptional_CanSpecifyDefaultValue()
var result = _deserializer.Deserialize(node, _errorReporter.Object);

// Assert
Assert.Equal(defaultInterval, result.DefaultedInterval);
Assert.Equal(DefaultInterval, result.DefaultedInterval);
}

[Fact]
Expand Down Expand Up @@ -268,7 +268,7 @@ public RegistrationConfigDeserializer(IDeserializer<object> childDeserializer) :
Map(t => t.Classes).IsRequired();
Map(t => t.Town);
Map(t => t.Interval);
Map(t => t.DefaultedInterval).WithDefault(defaultInterval);
Map(t => t.DefaultedInterval).WithDefault(DefaultInterval);
Map(t => t.NullableInterval);
Map(t => t.InvertedProperty)
.MapUsing(InvertBooleanString);
Expand Down

0 comments on commit 2a96594

Please sign in to comment.