Prechádzať zdrojové kódy

Run dotnet format over repo

Nick Babcock 1 rok pred
rodič
commit
39bd35de04

+ 1 - 1
OhmGraphite.Test/ConfigTest.cs

@@ -10,7 +10,7 @@ namespace OhmGraphite.Test
         [Fact]
         public void CanParseGraphiteConfig()
         {
-            var configMap = new ExeConfigurationFileMap {ExeConfigFilename = "assets/graphite.config"};
+            var configMap = new ExeConfigurationFileMap { ExeConfigFilename = "assets/graphite.config" };
             var config = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None);
             var customConfig = new CustomConfig(config);
             var results = MetricConfig.ParseAppSettings(customConfig);

+ 1 - 1
OhmGraphite.Test/GraphiteTest.cs

@@ -66,7 +66,7 @@ namespace OhmGraphite.Test
             var port = container.GetMappedPublicPort(2003);
             using var writer = new GraphiteWriter(container.Hostname, port, "my-pc", tags: true);
             using var client = new HttpClient();
-            for (int attempts = 0;; attempts++)
+            for (int attempts = 0; ; attempts++)
             {
                 try
                 {

+ 6 - 6
OhmGraphite.Test/InfluxTest.cs

@@ -30,7 +30,7 @@ namespace OhmGraphite.Test
             var config = new InfluxConfig(new Uri(baseUrl), "mydb", "my_user", "my_pass");
             using var writer = new InfluxWriter(config, "my-pc");
             using var client = new HttpClient();
-            for (int attempts = 0;; attempts++)
+            for (int attempts = 0; ; attempts++)
             {
                 try
                 {
@@ -73,7 +73,7 @@ namespace OhmGraphite.Test
             var config = new InfluxConfig(new Uri(baseUrl), "mydb", "my_user", null);
             using var writer = new InfluxWriter(config, "my-pc");
             using var client = new HttpClient();
-            for (int attempts = 0;; attempts++)
+            for (int attempts = 0; ; attempts++)
             {
                 try
                 {
@@ -125,7 +125,7 @@ namespace OhmGraphite.Test
             var config = new Influx2Config(options);
 
             using var writer = new Influx2Writer(config, "my-pc");
-            for (int attempts = 0;; attempts++)
+            for (int attempts = 0; ; attempts++)
             {
                 try
                 {
@@ -169,14 +169,14 @@ namespace OhmGraphite.Test
             await container.StartAsync();
 
             var baseUrl = $"http://{container.Hostname}:{container.GetMappedPublicPort(8086)}";
-            var configMap = new ExeConfigurationFileMap {ExeConfigFilename = "assets/influx2.config"};
+            var configMap = new ExeConfigurationFileMap { ExeConfigFilename = "assets/influx2.config" };
             var config = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None);
             config.AppSettings.Settings["influx2_address"].Value = baseUrl;
             var customConfig = new CustomConfig(config);
             var results = MetricConfig.ParseAppSettings(customConfig);
 
             using var writer = new Influx2Writer(results.Influx2, "my-pc");
-            for (int attempts = 0;; attempts++)
+            for (int attempts = 0; ; attempts++)
             {
                 try
                 {
@@ -245,7 +245,7 @@ namespace OhmGraphite.Test
             try
             {
                 using var writer = new Influx2Writer(results.Influx2, "my-pc");
-                for (int attempts = 0;; attempts++)
+                for (int attempts = 0; ; attempts++)
                 {
                     try
                     {

+ 2 - 1
OhmGraphite.Test/OhmCliTest.cs

@@ -6,7 +6,8 @@ namespace OhmGraphite.Test
     public class OhmCliTest
     {
         [Fact]
-        public async Task CanExecuteCliVersion() {
+        public async Task CanExecuteCliVersion()
+        {
             await OhmCli.Execute(new[] { "--version" });
         }
 

+ 1 - 1
OhmGraphite.Test/SensorCollectorTest.cs

@@ -17,7 +17,7 @@ namespace OhmGraphite.Test
 
             var computer = new Computer();
             using var collector = new SensorCollector(computer, MetricConfig.ParseAppSettings(new BlankConfig()));
-            
+
             collector.Open();
             var unused = collector.ReadAllSensors().Count();
 

+ 1 - 1
OhmGraphite.Test/TimescaleTest.cs

@@ -54,7 +54,7 @@ namespace OhmGraphite.Test
             await using var container = testContainersBuilder.Build();
             await container.StartAsync();
 
-            string selectStr =$"Host={container.Hostname};Username=postgres;Password=123456;Port={container.GetMappedPublicPort(5432)};Database=timescale_built";
+            string selectStr = $"Host={container.Hostname};Username=postgres;Password=123456;Port={container.GetMappedPublicPort(5432)};Database=timescale_built";
             var epoch = new DateTime(2001, 1, 13, 0, 0, 0, DateTimeKind.Utc);
 
             string connStr = $"Host={container.Hostname};Username=ohm;Password=itsohm;Port={container.GetMappedPublicPort(5432)};Database=timescale_built";

+ 1 - 1
OhmGraphite/MetricConfig.cs

@@ -107,7 +107,7 @@ namespace OhmGraphite
 
         private static EnabledHardware ParseEnabledHardware(IAppConfig config)
         {
-            return new (
+            return new(
                 config["/cpu/enabled"]?.ToLowerInvariant() != "false",
                 config["/gpu/enabled"]?.ToLowerInvariant() != "false",
                 config["/motherboard/enabled"]?.ToLowerInvariant() != "false",

+ 1 - 1
OhmGraphite/MetricTimer.cs

@@ -16,7 +16,7 @@ namespace OhmGraphite
 
         public MetricTimer(TimeSpan interval, IGiveSensors collector, IWriteMetrics writer)
         {
-            _timer = new Timer(interval.TotalMilliseconds) {AutoReset = true};
+            _timer = new Timer(interval.TotalMilliseconds) { AutoReset = true };
             _timer.Elapsed += ReportMetrics;
             _collector = collector;
             _writer = writer;

+ 4 - 3
OhmGraphite/Translation.cs

@@ -49,7 +49,8 @@ namespace OhmGraphite
         Battery,
     }
 
-    public static class TranslationExtension {
+    public static class TranslationExtension
+    {
         public static SensorType ToOwnSensor(this LibreHardwareMonitor.Hardware.SensorType s)
         {
             switch (s)
@@ -63,11 +64,11 @@ namespace OhmGraphite
                 case LibreHardwareMonitor.Hardware.SensorType.Temperature:
                     return SensorType.Temperature;
                 case LibreHardwareMonitor.Hardware.SensorType.Load:
-                    return SensorType.Load; 
+                    return SensorType.Load;
                 case LibreHardwareMonitor.Hardware.SensorType.Frequency:
                     return SensorType.Frequency;
                 case LibreHardwareMonitor.Hardware.SensorType.Fan:
-                    return SensorType.Fan;  
+                    return SensorType.Fan;
                 case LibreHardwareMonitor.Hardware.SensorType.Flow:
                     return SensorType.Flow;
                 case LibreHardwareMonitor.Hardware.SensorType.Control: