Skip to content

Commit

Permalink
[Add] 62 EditorConfig File Reader (#102)
Browse files Browse the repository at this point in the history
- added a file header template to editorconfig
- added file header to all supported files
- fixed unit tests

Co-authored-by: Timo Schauties <[email protected]>
  • Loading branch information
Conundraah and Timo Schauties authored Jun 11, 2024
1 parent 6a9338f commit 4e2dde4
Show file tree
Hide file tree
Showing 129 changed files with 553 additions and 171 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ trim_trailing_whitespace = true

[*.cs]
# "run cleanup": https://betterprogramming.pub/enforce-net-code-style-with-editorconfig-d2f0d79091ac
# TODO: build real editorconfig file: https://github.com/dotnet/roslyn/blob/main/.editorconfig
# TODO: build real editorconfig file: https://github.com/dotnet/roslyn/blob/main/.editorconfig
file_header_template = MIT License \nCopyright (c) [2024] [nexus-main]

# Prefer var
csharp_style_var_for_built_in_types = false
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus.ClientGenerator/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Reflection;
// MIT License
// Copyright (c) [2024] [nexus-main]

using System.Reflection;
using Apollo3zehn.OpenApiClientGenerator;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus.UI/Charts/AvailabilityChart.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Components;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Components;
using Nexus.UI.Services;
using SkiaSharp;
using SkiaSharp.Views.Blazor;
Expand Down
13 changes: 8 additions & 5 deletions src/Nexus.UI/Charts/Chart.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Components;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.JSInterop;
using Nexus.UI.Services;
Expand Down Expand Up @@ -629,12 +632,12 @@ private float DrawYAxes(SKCanvas canvas, float xMin, float yMin, float yMax, Dic
private static void GetYLimits(double min, double max, out float minLimit, out float maxLimit, out float step)
{
/* There are a minimum of 10 ticks and a maximum of 40 ticks with the following approach:
*
* Min Max Range Significant Min-Rounded Max-Rounded Start Step_1 ... End Count
*
*
* Min Max Range Significant Min-Rounded Max-Rounded Start Step_1 ... End Count
*
* Min 0 32 32 2 0 100 0 10 ... 100 10
* 968 1000 32 2 900 1000 900 910 ... 1000 10
*
*
* Max 0 31 31 1 0 40 0 1 ... 40 40
* 969 1000 31 1 960 1000 960 961 ... 1000 40
*/
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus.UI/Charts/ChartTypes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using SkiaSharp;
// MIT License
// Copyright (c) [2024] [nexus-main]

using SkiaSharp;

namespace Nexus.UI.Charts;

Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/Core/AppState.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Text.Json;
Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/Core/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

namespace Nexus.UI.Core;

public static class Constants
Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/Core/EditModeItem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

namespace Nexus.UI.Core;

public record struct EditModeItem(string ResourceId, string PropertyKey);
3 changes: 3 additions & 0 deletions src/Nexus.UI/Core/NexusDemoClient.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using System.Net;
using System.Runtime.InteropServices;
using System.Text.Json;
Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/Core/PeriodConverter.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using MudBlazor;

namespace Nexus.UI.Core;
Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/Core/RepresentationKind.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

namespace Nexus.UI.Core;

public enum RepresentationKind
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus.UI/Core/Utilities.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
Expand Down Expand Up @@ -308,7 +311,7 @@ private static JsonElement GetJsonObjectFromPath(this JsonElement root, Span<str
if (current.ValueKind == JsonValueKind.Object &&
current.TryGetProperty(pathSegement, out current))
{
// do nothing
// do nothing
}
else
{
Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/Core/ViewState.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

namespace Nexus.UI.Core;

public enum ViewState
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus.UI/Pages/ChartTest.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Nexus.UI.Charts;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.UI.Charts;

namespace Nexus.UI.Pages;

Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.JSInterop;
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus.UI/Services/NexusAuthenticationStateProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Components.Authorization;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Components.Authorization;
using Nexus.Api;
using System.Security.Claims;

Expand Down
5 changes: 4 additions & 1 deletion src/Nexus.UI/Services/TypeFaceService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using SkiaSharp;
// MIT License
// Copyright (c) [2024] [nexus-main]

using SkiaSharp;
using System.Reflection;

namespace Nexus.UI.Services;
Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/ViewModels/CatalogItemSelectionViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.UI.Core;

namespace Nexus.UI.ViewModels;
Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/ViewModels/CatalogItemViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.Api;
using Nexus.UI.Core;

Expand Down
5 changes: 4 additions & 1 deletion src/Nexus.UI/ViewModels/FakeResourceCatalogViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.Api;
using Nexus.UI.Core;

Expand Down Expand Up @@ -28,7 +31,7 @@ private static List<ResourceCatalogViewModel> PrepareChildCatalogs(
INexusClient client,
AppState appState)
{
/* This methods creates intermediate fake catalogs (marked with a *)
/* This methods creates intermediate fake catalogs (marked with a *)
* to group child catalogs. Example:
*
* /A/A/A
Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/ViewModels/JobViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using System.ComponentModel;
using Nexus.Api;
using TaskStatus = Nexus.Api.TaskStatus;
Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/ViewModels/RealResourceCatalogViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.Api;
using Nexus.UI.Core;

Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/ViewModels/ResourceCatalogViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.Api;
using Nexus.UI.Core;

Expand Down
3 changes: 3 additions & 0 deletions src/Nexus.UI/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using System.ComponentModel;
using System.Text.Json;
using Microsoft.JSInterop;
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/API/ArtifactsController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Authorization;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Nexus.Services;

Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/API/CatalogsController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Authorization;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Nexus.Core;
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/API/DataController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Authorization;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Nexus.Services;
Expand Down
7 changes: 5 additions & 2 deletions src/Nexus/API/JobsController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Authorization;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Nexus.Core;
Expand Down Expand Up @@ -97,7 +100,7 @@ public async Task<ActionResult<JobStatus>> GetJobStatusAsync(Guid jobId)
{
var isAdmin = User.IsInRole(NexusRoles.ADMINISTRATOR);
var username = (User.Identity?.Name) ?? throw new Exception("This should never happen.");

if (jobControl.Job.Owner == username || isAdmin)
{
var status = new JobStatus(
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/API/PackageReferencesController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Authorization;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Nexus.Core;
using Nexus.Services;
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/API/SourcesController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Authorization;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Nexus.Core;
using Nexus.Extensibility;
Expand Down
7 changes: 5 additions & 2 deletions src/Nexus/API/SystemController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Authorization;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Nexus.Core;
Expand All @@ -21,7 +24,7 @@ internal class SystemController(
{
// [authenticated]
// GET /api/system/configuration
// GET /api/system/file-type
// GET /api/system/file-type
// GET /api/system/help-link

// [privileged]
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/API/UsersController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Authentication;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/API/WritersController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Authorization;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Nexus.Core;

Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/Assembly.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Runtime.CompilerServices;
// MIT License
// Copyright (c) [2024] [nexus-main]

using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Nexus.Tests")]
[assembly: InternalsVisibleTo("Nexus.Core.Tests")]
Expand Down
3 changes: 3 additions & 0 deletions src/Nexus/Core/AppState.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.DataModel;
using System.Collections.Concurrent;
using System.Reflection;
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/Core/CacheEntryWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.Utilities;

namespace Nexus.Core;
Expand Down Expand Up @@ -56,7 +59,7 @@ public async Task<Interval[]> ReadAsync(
* |___|__ begin _________________
* | |
* |___|__ file begin
*
*
*/

var index = 0;
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/Core/CatalogCache.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Nexus.DataModel;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.DataModel;
using System.Collections.Concurrent;

namespace Nexus.Core;
Expand Down
9 changes: 6 additions & 3 deletions src/Nexus/Core/CatalogContainer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Nexus.DataModel;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.DataModel;
using Nexus.Services;
using Nexus.Utilities;
using System.Diagnostics;
Expand Down Expand Up @@ -99,7 +102,7 @@ public async Task<LazyCatalogInfo> GetLazyCatalogInfoAsync(CancellationToken can
{
await EnsureLazyCatalogInfoAsync(cancellationToken);

var lazyCatalogInfo = _lazyCatalogInfo
var lazyCatalogInfo = _lazyCatalogInfo
?? throw new Exception("this should never happen");
return lazyCatalogInfo;
}
Expand Down Expand Up @@ -161,7 +164,7 @@ private async Task EnsureLazyCatalogInfoAsync(CancellationToken cancellationToke
if (Metadata?.Overrides is not null)
catalog = catalog.Merge(Metadata.Overrides);

//
//
_lazyCatalogInfo = new LazyCatalogInfo(catalogBegin, catalogEnd, catalog);
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/Nexus/Core/CatalogContainerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Nexus.DataModel;
// MIT License
// Copyright (c) [2024] [nexus-main]

using Nexus.DataModel;

namespace Nexus.Core;

Expand Down
Loading

0 comments on commit 4e2dde4

Please sign in to comment.