From e94a2dcee3f07a282e397ae9cc0bf98f7878e85a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 00:00:58 +0000 Subject: [PATCH] Automated dotnet-format update --- .../Contexts/AppDbContext.cs | 2 +- .../Controllers/CrashUploadController.cs | 8 ++++---- .../Controllers/ReportController.cs | 6 +++--- .../Migrations/20240224211446_Initial.cs | 7 ++++--- .../Models/Sitemaps/ChangeFrequency.cs | 2 +- .../Models/Sitemaps/Sitemap.cs | 8 ++++---- .../Models/Sitemaps/SitemapIndex.cs | 8 ++++---- src/BUTR.CrashReportServer/Models/Sitemaps/Url.cs | 14 +++++++------- .../Models/Sitemaps/Urlset.cs | 11 ++++++----- src/BUTR.CrashReportServer/Program.cs | 2 +- .../Services/HexGenerator.cs | 4 ++-- src/BUTR.CrashReportServer/Startup.cs | 4 ++-- 12 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/BUTR.CrashReportServer/Contexts/AppDbContext.cs b/src/BUTR.CrashReportServer/Contexts/AppDbContext.cs index cc4ab1b..12783c7 100644 --- a/src/BUTR.CrashReportServer/Contexts/AppDbContext.cs +++ b/src/BUTR.CrashReportServer/Contexts/AppDbContext.cs @@ -10,7 +10,7 @@ public class AppDbContext : DbContext public DbSet IdEntities { get; set; } public DbSet FileEntities { get; set; } public DbSet JsonEntities { get; set; } - + public AppDbContext(DbContextOptions options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) diff --git a/src/BUTR.CrashReportServer/Controllers/CrashUploadController.cs b/src/BUTR.CrashReportServer/Controllers/CrashUploadController.cs index 88f7859..1ac027e 100644 --- a/src/BUTR.CrashReportServer/Controllers/CrashUploadController.cs +++ b/src/BUTR.CrashReportServer/Controllers/CrashUploadController.cs @@ -36,7 +36,7 @@ public sealed record CrashReportUploadBody(CrashReportModel CrashReport, ICollec { Converters = { new JsonStringEnumConverter() } }; - + private readonly ILogger _logger; private readonly CrashUploadOptions _options; private readonly JsonSerializerOptions _jsonSerializerOptions; @@ -58,7 +58,7 @@ public CrashUploadController( var meter = meterFactory.Create("BUTR.CrashReportServer.Controllers.CrashUploadController", "1.0.0"); _reportVersion = meter.CreateCounter("report-version", unit: "Count"); - + _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _jsonSerializerOptions = jsonSerializerOptions.Value ?? throw new ArgumentNullException(nameof(jsonSerializerOptions)); _options = options.Value ?? throw new ArgumentNullException(nameof(options)); @@ -128,8 +128,8 @@ private async Task UploadJsonAsync(CancellationToken ct) await _dbContext.FileEntities.AddAsync(new FileEntity { FileId = idEntity.FileId, DataCompressed = compressedHtmlStream.ToArray(), }, ct); await _dbContext.SaveChangesAsync(ct); - _reportVersion.Add(1, new[] {new KeyValuePair("Version", crashReport.Version)}); - + _reportVersion.Add(1, new[] { new KeyValuePair("Version", crashReport.Version) }); + return Ok($"{_options.BaseUri}/{idEntity.FileId}"); } diff --git a/src/BUTR.CrashReportServer/Controllers/ReportController.cs b/src/BUTR.CrashReportServer/Controllers/ReportController.cs index a7312c2..bc083bc 100644 --- a/src/BUTR.CrashReportServer/Controllers/ReportController.cs +++ b/src/BUTR.CrashReportServer/Controllers/ReportController.cs @@ -99,7 +99,7 @@ private async Task GetJson(string filename, CancellationToken ct) { Response.Headers.ContentEncoding = "gzip"; return File(await _gZipCompressor.CompressAsync(new MemoryStream(Encoding.UTF8.GetBytes(file.CrashReport)), ct), "application/json; charset=utf-8", true); - + } return File(new MemoryStream(Encoding.UTF8.GetBytes(file.CrashReport)), "application/json; charset=utf-8", true); } @@ -198,7 +198,7 @@ public IActionResult SitemapIndex() { var count = _dbContext.IdEntities.Count(); var sitemaps = (count / 50000) + 1; - + var sitemap = new SitemapIndex { Sitemap = Enumerable.Range(0, sitemaps).Select(x => new Sitemap @@ -208,7 +208,7 @@ public IActionResult SitemapIndex() }; return Ok(sitemap); } - + [AllowAnonymous] [HttpGet("sitemap_{idx:int}.xml")] [Produces("application/xml")] diff --git a/src/BUTR.CrashReportServer/Migrations/20240224211446_Initial.cs b/src/BUTR.CrashReportServer/Migrations/20240224211446_Initial.cs index b45ff50..af35e66 100644 --- a/src/BUTR.CrashReportServer/Migrations/20240224211446_Initial.cs +++ b/src/BUTR.CrashReportServer/Migrations/20240224211446_Initial.cs @@ -1,5 +1,6 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; + +using System; #nullable disable @@ -80,4 +81,4 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "id_entity"); } } -} +} \ No newline at end of file diff --git a/src/BUTR.CrashReportServer/Models/Sitemaps/ChangeFrequency.cs b/src/BUTR.CrashReportServer/Models/Sitemaps/ChangeFrequency.cs index 0a9fe34..0477991 100644 --- a/src/BUTR.CrashReportServer/Models/Sitemaps/ChangeFrequency.cs +++ b/src/BUTR.CrashReportServer/Models/Sitemaps/ChangeFrequency.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Xml.Serialization; namespace BUTR.CrashReportServer.Models.Sitemaps; diff --git a/src/BUTR.CrashReportServer/Models/Sitemaps/Sitemap.cs b/src/BUTR.CrashReportServer/Models/Sitemaps/Sitemap.cs index 4a208f3..a8775b2 100644 --- a/src/BUTR.CrashReportServer/Models/Sitemaps/Sitemap.cs +++ b/src/BUTR.CrashReportServer/Models/Sitemaps/Sitemap.cs @@ -1,10 +1,10 @@ -using System.Xml.Serialization; +using System.Xml.Serialization; namespace BUTR.CrashReportServer.Models.Sitemaps; -[XmlRoot(ElementName="sitemap", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] +[XmlRoot(ElementName = "sitemap", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] public class Sitemap -{ - [XmlElement(ElementName="loc", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] +{ + [XmlElement(ElementName = "loc", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] public string Location { get; set; } } \ No newline at end of file diff --git a/src/BUTR.CrashReportServer/Models/Sitemaps/SitemapIndex.cs b/src/BUTR.CrashReportServer/Models/Sitemaps/SitemapIndex.cs index 5363793..8fcf167 100644 --- a/src/BUTR.CrashReportServer/Models/Sitemaps/SitemapIndex.cs +++ b/src/BUTR.CrashReportServer/Models/Sitemaps/SitemapIndex.cs @@ -1,12 +1,12 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Xml.Serialization; namespace BUTR.CrashReportServer.Models.Sitemaps; -[XmlRoot(ElementName="sitemapindex", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] +[XmlRoot(ElementName = "sitemapindex", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] public class SitemapIndex -{ +{ - [XmlElement(ElementName="sitemap", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] + [XmlElement(ElementName = "sitemap", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] public List Sitemap { get; set; } } \ No newline at end of file diff --git a/src/BUTR.CrashReportServer/Models/Sitemaps/Url.cs b/src/BUTR.CrashReportServer/Models/Sitemaps/Url.cs index 82ab4e9..6127d3d 100644 --- a/src/BUTR.CrashReportServer/Models/Sitemaps/Url.cs +++ b/src/BUTR.CrashReportServer/Models/Sitemaps/Url.cs @@ -1,27 +1,27 @@ -using System; +using System; using System.Xml.Serialization; namespace BUTR.CrashReportServer.Models.Sitemaps; -[XmlRoot(ElementName="url", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] +[XmlRoot(ElementName = "url", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] public class Url { - [XmlElement(ElementName="loc", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] + [XmlElement(ElementName = "loc", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] public string Location { get; set; } [XmlIgnore] public DateTime TimeStamp { get; set; } - - [XmlElement(ElementName="lastmod", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] + + [XmlElement(ElementName = "lastmod", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] public string LastMod { get => TimeStamp.ToString("yyyy-MM-ddTHH:mm:sszzz"); set => TimeStamp = DateTime.Parse(value); } - [XmlElement(ElementName="changefreq", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] + [XmlElement(ElementName = "changefreq", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] public ChangeFrequency ChangeFrequency { get; set; } - [XmlElement(ElementName="priority", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] + [XmlElement(ElementName = "priority", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] public double Priority { get; set; } } \ No newline at end of file diff --git a/src/BUTR.CrashReportServer/Models/Sitemaps/Urlset.cs b/src/BUTR.CrashReportServer/Models/Sitemaps/Urlset.cs index 8bde429..c82a70a 100644 --- a/src/BUTR.CrashReportServer/Models/Sitemaps/Urlset.cs +++ b/src/BUTR.CrashReportServer/Models/Sitemaps/Urlset.cs @@ -1,11 +1,12 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Xml.Serialization; namespace BUTR.CrashReportServer.Models.Sitemaps; -[XmlRoot(ElementName="urlset", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] -public class Urlset { +[XmlRoot(ElementName = "urlset", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] +public class Urlset +{ - [XmlElement(ElementName="url", Namespace="http://www.sitemaps.org/schemas/sitemap/0.9")] - public List Url { get; set; } + [XmlElement(ElementName = "url", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")] + public List Url { get; set; } } \ No newline at end of file diff --git a/src/BUTR.CrashReportServer/Program.cs b/src/BUTR.CrashReportServer/Program.cs index dcfbc23..ccc2ea6 100644 --- a/src/BUTR.CrashReportServer/Program.cs +++ b/src/BUTR.CrashReportServer/Program.cs @@ -32,7 +32,7 @@ public static async Task Main(string[] args) .Enrich.FromLogContext() .WriteTo.Console() .CreateBootstrapLogger(); - + try { Log.Information("Starting web application"); diff --git a/src/BUTR.CrashReportServer/Services/HexGenerator.cs b/src/BUTR.CrashReportServer/Services/HexGenerator.cs index 7d15706..84964a5 100644 --- a/src/BUTR.CrashReportServer/Services/HexGenerator.cs +++ b/src/BUTR.CrashReportServer/Services/HexGenerator.cs @@ -29,11 +29,11 @@ public HashSet GetHex(int maxCount, int length) { var charLength = length * 2; var byteLength = length; - + Span output = stackalloc char[maxCount * charLength]; Span input = stackalloc byte[maxCount * byteLength]; _random.GetBytes(input); - + var unique = new HashSet(maxCount); GenerateHexChars(input, output); for (var i = 0; i < output.Length; i += charLength) diff --git a/src/BUTR.CrashReportServer/Startup.cs b/src/BUTR.CrashReportServer/Startup.cs index fd783fb..789a10f 100644 --- a/src/BUTR.CrashReportServer/Startup.cs +++ b/src/BUTR.CrashReportServer/Startup.cs @@ -111,7 +111,7 @@ public void ConfigureServices(IServiceCollection services) opts.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; opts.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase)); }); - + services.AddResponseCaching(); } @@ -126,7 +126,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseSwaggerUI(options => options.SwaggerEndpoint("/swagger/v1/swagger.json", _appName)); app.UseRouting(); - + app.UseResponseCaching(); app.UseAuthentication();