diff --git a/BookReader/.editorconfig b/BookReader/.editorconfig new file mode 100644 index 0000000..3825a19 --- /dev/null +++ b/BookReader/.editorconfig @@ -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 diff --git a/BookReader/.github/workflows/ci-cd.yml b/BookReader/.github/workflows/ci-cd.yml new file mode 100644 index 0000000..db1cd8e --- /dev/null +++ b/BookReader/.github/workflows/ci-cd.yml @@ -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 diff --git a/BookReader/Directory.Build.props b/BookReader/Directory.Build.props new file mode 100644 index 0000000..62e3c6b --- /dev/null +++ b/BookReader/Directory.Build.props @@ -0,0 +1,17 @@ + + + latest + AllEnabledByDefault + true + true + + + + true + 5 + + + + + + diff --git a/BookReader/Platforms/Android/AndroidManifest.xml b/BookReader/Platforms/Android/AndroidManifest.xml index f372083..7e30c70 100644 --- a/BookReader/Platforms/Android/AndroidManifest.xml +++ b/BookReader/Platforms/Android/AndroidManifest.xml @@ -3,6 +3,7 @@ diff --git a/BookReader/Platforms/Android/Resources/values/styles.xml b/BookReader/Platforms/Android/Resources/values/styles.xml new file mode 100644 index 0000000..035069a --- /dev/null +++ b/BookReader/Platforms/Android/Resources/values/styles.xml @@ -0,0 +1,27 @@ + + + + + diff --git a/BookReader/sonar-project.properties b/BookReader/sonar-project.properties new file mode 100644 index 0000000..688913f --- /dev/null +++ b/BookReader/sonar-project.properties @@ -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=**/*