qwen edit
This commit is contained in:
97
BookReader/.editorconfig
Normal file
97
BookReader/.editorconfig
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
# Editor configuration for BookReader
|
||||||
|
# https://editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = crlf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.cs]
|
||||||
|
# Organize usings
|
||||||
|
dotnet_sort_system_directives_first = true
|
||||||
|
dotnet_separate_import_directive_groups = false
|
||||||
|
|
||||||
|
# this. preferences
|
||||||
|
dotnet_style_qualification_for_field = false:warning
|
||||||
|
dotnet_style_qualification_for_property = false:warning
|
||||||
|
dotnet_style_qualification_for_method = false:warning
|
||||||
|
dotnet_style_qualification_for_event = false:warning
|
||||||
|
|
||||||
|
# Language keywords vs BCL types preferences
|
||||||
|
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
|
||||||
|
dotnet_style_predefined_type_for_member_access = true:warning
|
||||||
|
|
||||||
|
# Parentheses preferences
|
||||||
|
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
|
||||||
|
|
||||||
|
# Modifier preferences
|
||||||
|
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
|
||||||
|
dotnet_style_readonly_field = true:warning
|
||||||
|
|
||||||
|
# Expression-level preferences
|
||||||
|
dotnet_style_object_initializer = true:warning
|
||||||
|
dotnet_style_collection_initializer = true:warning
|
||||||
|
dotnet_style_explicit_tuple_names = true:warning
|
||||||
|
dotnet_style_prefer_inferred_tuple_names = true:warning
|
||||||
|
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
|
||||||
|
dotnet_style_prefer_auto_properties = true:warning
|
||||||
|
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
|
||||||
|
dotnet_style_prefer_conditional_expression_over_return = true:silent
|
||||||
|
|
||||||
|
# Null-checking preferences
|
||||||
|
dotnet_style_coalesce_expression = true:warning
|
||||||
|
dotnet_style_null_propagation = true:warning
|
||||||
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
|
||||||
|
|
||||||
|
# C# style rules
|
||||||
|
csharp_style_var_for_built_in_types = false:warning
|
||||||
|
csharp_style_var_when_type_is_apparent = true:warning
|
||||||
|
csharp_style_var_elsewhere = false:silent
|
||||||
|
|
||||||
|
# Expression-bodied members
|
||||||
|
csharp_style_expression_bodied_methods = when_on_single_line:silent
|
||||||
|
csharp_style_expression_bodied_constructors = false:silent
|
||||||
|
csharp_style_expression_bodied_operators = when_on_single_line:silent
|
||||||
|
csharp_style_expression_bodied_properties = true:silent
|
||||||
|
csharp_style_expression_bodied_indexers = true:silent
|
||||||
|
csharp_style_expression_bodied_accessors = true:silent
|
||||||
|
|
||||||
|
# Pattern matching
|
||||||
|
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
|
||||||
|
csharp_style_pattern_matching_over_as_with_null_check = true:warning
|
||||||
|
csharp_style_prefer_switch_expression = true:warning
|
||||||
|
csharp_style_prefer_pattern_matching = true:warning
|
||||||
|
|
||||||
|
# Null-checking
|
||||||
|
csharp_style_throw_expression = true:warning
|
||||||
|
csharp_style_conditional_delegate_call = true:warning
|
||||||
|
|
||||||
|
# Code blocks
|
||||||
|
csharp_prefer_braces = true:warning
|
||||||
|
csharp_prefer_simple_default_expression = true:warning
|
||||||
|
|
||||||
|
# Namespace preferences
|
||||||
|
csharp_style_namespace_declarations = file_scoped:warning
|
||||||
|
|
||||||
|
# File-scoped namespaces
|
||||||
|
csharp_style_file_scoped_namespace = true:warning
|
||||||
|
|
||||||
|
# Modifier preferences
|
||||||
|
csharp_style_prefer_required_member = true:suggestion
|
||||||
|
|
||||||
|
# Primary constructors
|
||||||
|
csharp_style_prefer_primary_constructors = true:suggestion
|
||||||
|
|
||||||
|
[*.xaml]
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{csproj,props,config}]
|
||||||
|
indent_size = 2
|
||||||
43
BookReader/.github/workflows/ci-cd.yml
vendored
Normal file
43
BookReader/.github/workflows/ci-cd.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
name: .NET MAUI CI/CD
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main", "develop" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main", "develop" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: '10.0.x'
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore BookReader.sln
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build BookReader.sln --configuration Release --no-restore
|
||||||
|
|
||||||
|
- name: Run Code Analysis
|
||||||
|
run: dotnet build BookReader.sln --configuration Release --no-restore /p:RunAnalyzers=true /p:EnforceCodeStyleInBuild=true
|
||||||
|
|
||||||
|
- name: Publish APK (Debug)
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
run: |
|
||||||
|
dotnet publish BookReader/BookReader.csproj -c Release -f net10.0-android --no-restore
|
||||||
|
|
||||||
|
- name: Upload APK
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: app-release
|
||||||
|
path: |
|
||||||
|
**/bin/**/Release/**/*.apk
|
||||||
17
BookReader/Directory.Build.props
Normal file
17
BookReader/Directory.Build.props
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AnalysisLevel>latest</AnalysisLevel>
|
||||||
|
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
|
||||||
|
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||||
|
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||||
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>5</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0" PrivateAssets="all" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Maui.Main"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|||||||
27
BookReader/Platforms/Android/Resources/values/styles.xml
Normal file
27
BookReader/Platforms/Android/Resources/values/styles.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Base application theme that inherits from MaterialComponents -->
|
||||||
|
<style name="Maui.Main" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
|
<!-- Primary brand color -->
|
||||||
|
<item name="colorPrimary">#5D4037</item>
|
||||||
|
<item name="colorPrimaryVariant">#3E2723</item>
|
||||||
|
<item name="colorOnPrimary">@android:color/white</item>
|
||||||
|
|
||||||
|
<!-- Secondary brand color -->
|
||||||
|
<item name="colorSecondary">#8D6E63</item>
|
||||||
|
<item name="colorSecondaryVariant">#6D4C41</item>
|
||||||
|
<item name="colorOnSecondary">@android:color/white</item>
|
||||||
|
|
||||||
|
<!-- Status bar color -->
|
||||||
|
<item name="android:statusBarColor">#3E2723</item>
|
||||||
|
|
||||||
|
<!-- Navigation bar color -->
|
||||||
|
<item name="android:navigationBarColor">#3E2723</item>
|
||||||
|
|
||||||
|
<!-- Window background -->
|
||||||
|
<item name="android:windowBackground">#3E2723</item>
|
||||||
|
|
||||||
|
<!-- Text appearance -->
|
||||||
|
<item name="textAppearanceButton">@style/TextAppearance.MaterialComponents.Button</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
28
BookReader/sonar-project.properties
Normal file
28
BookReader/sonar-project.properties
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# SonarQube configuration for BookReader
|
||||||
|
# https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/
|
||||||
|
|
||||||
|
# Project identification
|
||||||
|
sonar.projectKey=BookReader
|
||||||
|
sonar.projectName=BookReader
|
||||||
|
sonar.projectVersion=1.0
|
||||||
|
|
||||||
|
# Source configuration
|
||||||
|
sonar.sources=BookReader/
|
||||||
|
sonar.tests=BookReader.Tests/
|
||||||
|
sonar.cs.vscoveragexml.reportsPath=coverage/
|
||||||
|
|
||||||
|
# Exclusions
|
||||||
|
sonar.exclusions=**/bin/**,**/obj/**,**/*.Designer.cs,**/Resources/**,**/*.xaml
|
||||||
|
sonar.test.exclusions=**/bin/**,**/obj/**
|
||||||
|
|
||||||
|
# C# specific settings
|
||||||
|
sonar.cs.analyzeGeneratedCode=false
|
||||||
|
sonar.coverage.exclusions=**/*.xaml.cs,**/Converters/**,**/Views/**
|
||||||
|
|
||||||
|
# Quality Gate settings
|
||||||
|
sonar.qualitygate.wait=true
|
||||||
|
|
||||||
|
# Issue severity
|
||||||
|
sonar.issue.ignore.multicriteria=e1
|
||||||
|
sonar.issue.ignore.multicriteria.e1.ruleKey=csharp:S1134
|
||||||
|
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*
|
||||||
Reference in New Issue
Block a user