Skip to content

Commit

Permalink
Enable SA1515 / SA1516 and fix violations
Browse files Browse the repository at this point in the history
SA1515: SingleLineCommentMustBePrecededByBlankLine
SA1516: ElementsMustBeSeparatedByBlankLine
  • Loading branch information
danjov committed Nov 22, 2024
1 parent 77f2015 commit 5335b5c
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ dotnet_diagnostic.SA1503.severity = none
dotnet_diagnostic.SA1504.severity = none
dotnet_diagnostic.SA1512.severity = warning
dotnet_diagnostic.SA1513.severity = warning
dotnet_diagnostic.SA1516.severity = none
dotnet_diagnostic.SA1515.severity = warning
dotnet_diagnostic.SA1516.severity = warning
dotnet_diagnostic.SA1600.severity = none
dotnet_diagnostic.SA1601.severity = none
dotnet_diagnostic.SA1602.severity = none
Expand Down
34 changes: 32 additions & 2 deletions src/api/BdmsContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,75 @@ namespace BDMS;
public class BdmsContext : DbContext
{
public DbSet<Borehole> Boreholes { get; set; }

public DbSet<Codelist> Codelists { get; set; }

public DbSet<Config> Configs { get; set; }

public DbSet<Models.File> Files { get; set; }

public DbSet<Layer> Layers { get; set; }

public DbSet<Stratigraphy> Stratigraphies { get; set; }

public DbSet<Term> Terms { get; set; }

public DbSet<User> Users { get; set; }

public IQueryable<User> UsersWithIncludes => Users
.Include(u => u.WorkgroupRoles)
.ThenInclude(wr => wr.Workgroup)
.Include(u => u.TermsAccepted)
.ThenInclude(ta => ta.Term);

public DbSet<UserWorkgroupRole> UserWorkgroupRoles { get; set; }

public DbSet<Workflow> Workflows { get; set; }

public DbSet<Workgroup> Workgroups { get; set; }

public IQueryable<Workgroup> WorkgroupsWithIncludes => Workgroups
.Include(w => w.Boreholes);
public IQueryable<Workgroup> WorkgroupsWithIncludes => Workgroups.Include(w => w.Boreholes);

public DbSet<BoreholeFile> BoreholeFiles { get; set; }

public DbSet<LithologicalDescription> LithologicalDescriptions { get; set; }

public DbSet<FaciesDescription> FaciesDescriptions { get; set; }

public DbSet<ChronostratigraphyLayer> ChronostratigraphyLayers { get; set; }

public DbSet<LithostratigraphyLayer> LithostratigraphyLayers { get; set; }

public DbSet<Observation> Observations { get; set; }

public DbSet<WaterIngress> WaterIngresses { get; set; }

public DbSet<Hydrotest> Hydrotests { get; set; }

public DbSet<HydrotestResult> HydrotestResults { get; set; }

public DbSet<GroundwaterLevelMeasurement> GroundwaterLevelMeasurements { get; set; }

public DbSet<FieldMeasurement> FieldMeasurements { get; set; }

public DbSet<FieldMeasurementResult> FieldMeasurementResults { get; set; }

public DbSet<Completion> Completions { get; set; }

public DbSet<Instrumentation> Instrumentations { get; set; }

public DbSet<Backfill> Backfills { get; set; }

public DbSet<Casing> Casings { get; set; }

public DbSet<CasingElement> CasingElements { get; set; }

public DbSet<Section> Sections { get; set; }

public DbSet<SectionElement> SectionElements { get; set; }

public DbSet<BoreholeGeometryElement> BoreholeGeometry { get; set; }

public DbSet<BoreholeCodelist> BoreholeCodelists { get; set; }

public BdmsContext(DbContextOptions options)
Expand Down
7 changes: 7 additions & 0 deletions src/api/BoreholeGeometry/AzIncFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ namespace BDMS.BoreholeGeometry;
internal sealed class AzIncFormat : IBoreholeGeometryFormat
{
public string Key => "AzInc";

public string Name => "Azimuth Inclination";

private Lazy<string> expectedCsvHeader = new(Helper.GetCSVHeader<Geometry>);

public string CsvHeader => expectedCsvHeader.Value;

public IList<BoreholeGeometryElement> ReadCsv(IFormFile file, int boreholeId)
Expand Down Expand Up @@ -96,12 +99,16 @@ internal sealed class Geometry
{
[Name("MD_m")]
public double MeasuredDepth { get; set; }

[Name("HAZI_deg")]
public double Azimuth { get; set; }

[Name("DEVI_deg")]
public double Inclination { get; set; }

[Ignore]
public double AzimuthRad { get; set; }

[Ignore]
public double InclinationRad { get; set; }
}
Expand Down
6 changes: 6 additions & 0 deletions src/api/BoreholeGeometry/PitchRollFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ namespace BDMS.BoreholeGeometry;
internal sealed class PitchRollFormat : IBoreholeGeometryFormat
{
public string Key => "PitchRoll";

public string Name => "Pitch Roll";

private Lazy<string> expectedCsvHeader = new(Helper.GetCSVHeader<Geometry>);

public string CsvHeader => expectedCsvHeader.Value;

public IList<BoreholeGeometryElement> ReadCsv(IFormFile file, int boreholeId)
Expand Down Expand Up @@ -66,10 +69,13 @@ internal sealed class Geometry
{
[Name("MD_m")]
public double MeasuredDepth { get; set; }

[Name("Roll_deg")]
public double RollRad { get; set; }

[Name("Pitch_deg")]
public double PitchRad { get; set; }

[Name("Yaw_deg")]
public double YawRad { get; set; }
}
Expand Down
3 changes: 3 additions & 0 deletions src/api/BoreholeGeometry/XYZFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ namespace BDMS.BoreholeGeometry;
internal sealed class XYZFormat : IBoreholeGeometryFormat
{
public string Key => "XYZ";

public string Name => "X Y Z";

private Lazy<string> expectedCsvHeader = new(Helper.GetCSVHeader<Geometry>);

public string CsvHeader => expectedCsvHeader.Value;

public IList<BoreholeGeometryElement> ReadCsv(IFormFile file, int boreholeId)
Expand Down
1 change: 1 addition & 0 deletions src/api/CoordinateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text.Json;

namespace BDMS;

public class CoordinateService
{
private const string Lv95ToLv03 = "lv95tolv03";
Expand Down
1 change: 1 addition & 0 deletions src/api/DateOnlyJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Text.Json.Serialization;

namespace BDMS;

public class DateOnlyJsonConverter : JsonConverter<DateOnly>
{
private const string Format = "yyyy-MM-dd";
Expand Down
1 change: 1 addition & 0 deletions src/api/LocationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Text.Json;

namespace BDMS;

public class LocationService
{
private readonly IHttpClientFactory httpClientFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#nullable disable

namespace BDMS.Migrations;

public partial class RemoveCantonsMunicipalities : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
Expand Down
2 changes: 2 additions & 0 deletions src/api/Models/Borehole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public class Borehole : IChangeTracking, IIdentifyable
/// </summary>
[Column("restriction_id_cli")]
public int? RestrictionId { get; set; }

public Codelist? Restriction { get; set; }

/// <summary>
Expand Down Expand Up @@ -191,6 +192,7 @@ public class Borehole : IChangeTracking, IIdentifyable
/// </summary>
[Column("qt_location_id_cli")]
public int? LocationPrecisionId { get; set; }

public Codelist? LocationPrecision { get; set; }

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/api/Models/HydrotestCodelist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ public class HydrotestCodelist
{
[Column("id_ht_fk")]
public int HydrotestId { get; set; }

public Hydrotest Hydrotest { get; set; }

[Column("id_cli_fk")]
public int CodelistId { get; set; }

public Codelist Codelist { get; set; }
}

0 comments on commit 5335b5c

Please sign in to comment.