diff --git a/.github/workflows/qodana_code_quality.yml b/.github/workflows/qodana_code_quality.yml new file mode 100644 index 0000000..ad76050 --- /dev/null +++ b/.github/workflows/qodana_code_quality.yml @@ -0,0 +1,28 @@ +name: Qodana +on: + workflow_dispatch: + pull_request: + push: + branches: # Specify your branches here + - main # The 'main' branch + - 'releases/*' # The release branches + +jobs: + qodana: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + checks: write + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit + fetch-depth: 0 # a full history is required for pull request analysis + - name: 'Qodana Scan' + uses: JetBrains/qodana-action@v2025.1 + with: + pr-mode: false + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_1557167003 }} + QODANA_ENDPOINT: 'https://qodana.cloud' \ No newline at end of file diff --git a/Meio.app/App.axaml b/Meio.app/App.axaml index 24342d2..7bc5830 100644 --- a/Meio.app/App.axaml +++ b/Meio.app/App.axaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Meio.app.App" RequestedThemeVariant="Default"> - + diff --git a/Meio.app/App.axaml.cs b/Meio.app/App.axaml.cs index 3649cc1..00e0160 100644 --- a/Meio.app/App.axaml.cs +++ b/Meio.app/App.axaml.cs @@ -1,11 +1,18 @@ using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Console; +using PrettyLogging.Console; namespace Meio.app; -public partial class App : Application +public class App : Application { + private static ILoggerFactory? LoggerFactory { get; set; } + + public static ILogger? Logger { get; private set; } + public override void Initialize() { AvaloniaXamlLoader.Load(this); @@ -13,6 +20,34 @@ public override void Initialize() public override void OnFrameworkInitializationCompleted() { + // Create and configure PrettyLogger + LoggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(builder => + { + builder.ClearProviders(); + builder.AddPrettyConsole(opt => + { + opt.ShowLogLevel = true; + opt.ShowEventId = false; + opt.ShowManagedThreadId = false; + opt.SingleLine = true; + opt.IncludeScopes = true; + opt.ShowTimestamp = true; + opt.LogLevelCase = LogLevelCase.Upper; + opt.CategoryMode = LoggerCategoryMode.Short; + opt.ColorBehavior = LoggerColorBehavior.Enabled; + opt.UseUtcTimestamp = false; + }); + +#if DEBUG + builder.SetMinimumLevel(LogLevel.Trace); +#else + builder.SetMinimumLevel(LogLevel.Information); +#endif + }); + + Logger = LoggerFactory.CreateLogger(); + Logger.LogInformation("Meio Application started."); + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { desktop.MainWindow = new MainWindow(); diff --git a/Meio.app/MainWindow.axaml b/Meio.app/MainWindow.axaml index 534c886..7f6c48b 100644 --- a/Meio.app/MainWindow.axaml +++ b/Meio.app/MainWindow.axaml @@ -4,6 +4,24 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Meio.app.MainWindow" - Title="Meio.app"> - Welcome to Avalonia! - + Title="Meio"> + + + + + + + Currently reading + + + + +