-
Notifications
You must be signed in to change notification settings - Fork 0
Update to .NET 10, adapt code style to Steeltoe conventions #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bart-vmware
wants to merge
23
commits into
main
Choose a base branch
from
update-net10
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
2d59a8a
Convert to slnx
bart-vmware 43156f5
Remove dependency on Steeltoe 3.x
bart-vmware 4632e53
Update to .NET 10, run tests during Docker build
bart-vmware e7d9bb4
Use file-scoped namespaces
bart-vmware d8a78db
Additional code cleanup
bart-vmware 216cc66
Apply style settings from Steeltoe
bart-vmware d9fe66c
Enable nullable reference types
bart-vmware 7abf17a
Use top-level statements, replace Swashbuckle with ASP.NET OpenAPI
bart-vmware 03c15f7
Docker tweaks
bart-vmware dae7081
Do not auto-redirect to https
bart-vmware 33fff4b
Delete CODEOWNERS
bart-vmware 5385fff
Only enable health actuator for non-development
bart-vmware 4689968
Disable install/uninstall endpoints by default
bart-vmware c08d956
Fixed: always use forward slashes in paths inside zip
bart-vmware ac2e310
Fixed: do not wrap into multiple exceptions
bart-vmware 6e0af70
Restore original log level
bart-vmware 381c37a
Fix broken error handling
bart-vmware 6c001af
Strip paths from output
bart-vmware e0e2e79
Remove UseAuthorization
bart-vmware 1630ca6
Move setting DOTNET_ENVIRONMENT in Docker, remove unused settings
bart-vmware 81bae95
Add code style verification
bart-vmware 0f3846c
Remove Nerdbank.GitVersioning
bart-vmware df06fe9
Set up vulnerability scans
bart-vmware File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "version": 1, | ||
| "isRoot": true, | ||
| "tools": { | ||
| "jetbrains.resharper.globaltools": { | ||
| "version": "2026.1.3", | ||
| "commands": [ | ||
| "jb" | ||
| ], | ||
| "rollForward": false | ||
| }, | ||
| "regitlint": { | ||
| "version": "6.3.13", | ||
| "commands": [ | ||
| "regitlint" | ||
| ], | ||
| "rollForward": false | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| Dockerfile | ||
| docker-compose.yaml | ||
| azure-pipelines.yaml | ||
| *.sln.DotSettings.user | ||
| deploy/ | ||
| */*/bin/ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,164 @@ | ||
| # EditorConfig is awesome: http://EditorConfig.org | ||
|
|
||
| # top-most EditorConfig file | ||
| root = true | ||
|
|
||
| [*] | ||
| indent_style = space | ||
| indent_size = 4 | ||
| tab-width = 4 | ||
| charset = utf-8 | ||
| trim_trailing_whitespace = true | ||
| insert_final_newline = true | ||
| max_line_length = 120 | ||
| charset = utf-8 | ||
|
|
||
| [*.{csproj,props,targets,DotSettings}] | ||
| [*.sh] | ||
| end_of_line = lf | ||
|
|
||
| [*.{build,config,csproj,js,json,proj,props,targets,xml,ruleset,xsd,yml,yaml}] | ||
| indent_size = 2 | ||
| tab-width = 2 | ||
| max_line_length = 160 | ||
|
|
||
| [*.cs] | ||
| indent_size = 4 | ||
| [*.{cs,cshtml,ascx,aspx}] | ||
|
|
||
| [*.yaml] | ||
| indent_size = 2 | ||
| #### C#/.NET Code Style #### | ||
|
|
||
| [*.ps1] | ||
| indent_size = 4 | ||
| # Default severity for IDE* analyzers with category 'Style' | ||
| # Note: specific rules below use severity silent, because Resharper code cleanup auto-fixes them. | ||
| dotnet_analyzer_diagnostic.category-Style.severity = warning | ||
|
|
||
| [*.json] | ||
| indent_size = 2 | ||
| # 'using' directive preferences | ||
| dotnet_sort_system_directives_first = true | ||
| csharp_using_directive_placement = outside_namespace:silent | ||
| # IDE0005: Remove unnecessary import | ||
| dotnet_diagnostic.IDE0005.severity = silent | ||
|
|
||
| # Namespace declarations | ||
| csharp_style_namespace_declarations = file_scoped:silent | ||
| # IDE0160: Use block-scoped namespace | ||
| dotnet_diagnostic.IDE0160.severity = silent | ||
| # IDE0161: Use file-scoped namespace | ||
| dotnet_diagnostic.IDE0161.severity = silent | ||
|
|
||
| # this. preferences | ||
| dotnet_style_qualification_for_field = false:silent | ||
| dotnet_style_qualification_for_property = false:silent | ||
| dotnet_style_qualification_for_method = false:silent | ||
| dotnet_style_qualification_for_event = false:silent | ||
| # IDE0003: Remove this or Me qualification | ||
| dotnet_diagnostic.IDE0003.severity = silent | ||
| # IDE0009: Add this or Me qualification | ||
| dotnet_diagnostic.IDE0009.severity = silent | ||
|
|
||
| # Language keywords vs BCL types preferences | ||
| dotnet_style_predefined_type_for_locals_parameters_members = true:silent | ||
| dotnet_style_predefined_type_for_member_access = true:silent | ||
| # IDE0049: Use language keywords instead of framework type names for type references | ||
| dotnet_diagnostic.IDE0049.severity = silent | ||
|
|
||
| # Modifier preferences | ||
| dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent | ||
| # IDE0040: Add accessibility modifiers | ||
| dotnet_diagnostic.IDE0040.severity = silent | ||
| csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:silent | ||
| # IDE0036: Order modifiers | ||
| dotnet_diagnostic.IDE0036.severity = silent | ||
|
|
||
| # Expression-level preferences | ||
| dotnet_style_operator_placement_when_wrapping = end_of_line | ||
| dotnet_style_prefer_auto_properties = true:silent | ||
| # IDE0032: Use auto property | ||
| dotnet_diagnostic.IDE0032.severity = silent | ||
| dotnet_style_prefer_conditional_expression_over_assignment = true:silent | ||
| # IDE0045: Use conditional expression for assignment | ||
| dotnet_diagnostic.IDE0045.severity = silent | ||
| dotnet_style_prefer_conditional_expression_over_return = true:silent | ||
| # IDE0046: Use conditional expression for return | ||
| dotnet_diagnostic.IDE0046.severity = silent | ||
| csharp_style_unused_value_expression_statement_preference = discard_variable:silent | ||
| # IDE0058: Remove unused expression value | ||
| dotnet_diagnostic.IDE0058.severity = silent | ||
|
|
||
| # Collection expression preferences (note: turned off in shared-package.props) | ||
| dotnet_style_prefer_collection_expression = when_types_exactly_match | ||
| dotnet_diagnostic.IDE0306.severity = silent # Workaround for https://github.com/dotnet/roslyn/issues/77177 | ||
|
|
||
| # Parameter preferences | ||
| dotnet_code_quality_unused_parameters = non_public | ||
|
|
||
| # Local functions vs lambdas | ||
| csharp_style_prefer_local_over_anonymous_function = false:silent | ||
| # IDE0039: Use local function instead of lambda | ||
| dotnet_diagnostic.IDE0039.severity = silent | ||
|
|
||
| # Expression-bodied members | ||
| csharp_style_expression_bodied_accessors = true:silent | ||
| # IDE0027: Use expression body for accessors | ||
| dotnet_diagnostic.IDE0027.severity = silent | ||
| csharp_style_expression_bodied_constructors = false:silent | ||
| # IDE0021: Use expression body for constructors | ||
| dotnet_diagnostic.IDE0021.severity = silent | ||
| csharp_style_expression_bodied_indexers = true:silent | ||
| # IDE0026: Use expression body for indexers | ||
| dotnet_diagnostic.IDE0026.severity = silent | ||
| csharp_style_expression_bodied_lambdas = true:silent | ||
| # IDE0053: Use expression body for lambdas | ||
| dotnet_diagnostic.IDE0053.severity = silent | ||
| csharp_style_expression_bodied_local_functions = false:silent | ||
| # IDE0061: Use expression body for local functions | ||
| dotnet_diagnostic.IDE0061.severity = silent | ||
| csharp_style_expression_bodied_methods = false:silent | ||
| # IDE0022: Use expression body for methods | ||
| dotnet_diagnostic.IDE0022.severity = silent | ||
| csharp_style_expression_bodied_operators = false:silent | ||
| # IDE0023: Use expression body for conversion operators | ||
| dotnet_diagnostic.IDE0023.severity = silent | ||
| # IDE0024: Use expression body for operators | ||
| dotnet_diagnostic.IDE0024.severity = silent | ||
| csharp_style_expression_bodied_properties = true:silent | ||
| # IDE0025: Use expression body for properties | ||
| dotnet_diagnostic.IDE0025.severity = silent | ||
|
|
||
| # Code-block preferences | ||
| csharp_prefer_braces = true:silent | ||
| # IDE0011: Add braces | ||
| dotnet_diagnostic.IDE0011.severity = silent | ||
|
|
||
| # Indentation preferences | ||
| csharp_indent_case_contents_when_block = false | ||
|
|
||
| # Wrapping preferences | ||
| csharp_preserve_single_line_statements = false | ||
|
|
||
| # 'var' usage preferences | ||
| csharp_style_var_for_built_in_types = false:silent | ||
| csharp_style_var_when_type_is_apparent = true:silent | ||
| csharp_style_var_elsewhere = false:silent | ||
| # IDE0007: Use var instead of explicit type | ||
| dotnet_diagnostic.IDE0007.severity = silent | ||
| # IDE0008: Use explicit type instead of var | ||
| dotnet_diagnostic.IDE0008.severity = silent | ||
|
|
||
| # Parentheses preferences | ||
| dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:silent | ||
| dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent | ||
| dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:silent | ||
| # IDE0047: Remove unnecessary parentheses | ||
| dotnet_diagnostic.IDE0047.severity = silent | ||
| # IDE0048: Add parentheses for clarity | ||
| dotnet_diagnostic.IDE0048.severity = silent | ||
|
|
||
| # IDE0010: Add missing cases to switch statement | ||
| dotnet_diagnostic.IDE0010.severity = silent | ||
| # IDE0072: Add missing cases to switch expression | ||
| dotnet_diagnostic.IDE0072.severity = silent | ||
|
|
||
| # IDE0029: Null check can be simplified | ||
| dotnet_diagnostic.IDE0029.severity = silent | ||
| # IDE0030: Null check can be simplified | ||
| dotnet_diagnostic.IDE0030.severity = silent | ||
| # IDE0270: Null check can be simplified | ||
| dotnet_diagnostic.IDE0270.severity = silent | ||
|
|
||
| [Dockerfile,*.sh] | ||
| end_of_line = lf | ||
| # JSON002: Probable JSON string detected | ||
| dotnet_diagnostic.JSON002.severity = silent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Enable running shell scripts from Docker on Windows | ||
| *.sh eol=lf |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: Scan vulnerable dependencies | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
| DOTNET_NOLOGO: true | ||
| SOLUTION_FILE: 'Steeltoe.NetCoreToolService.slnx' | ||
|
|
||
| jobs: | ||
| scan: | ||
| name: Scan | ||
| timeout-minutes: 15 | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: | | ||
| 10.0.* | ||
|
|
||
| - name: Git checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Report vulnerable dependencies | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
|
|
||
| $output = dotnet list ${{ env.SOLUTION_FILE }} package --vulnerable --include-transitive --format json --output-version 1 2>&1 | ||
| $text = ($output | Out-String).TrimEnd() | ||
| $json = $text | ConvertFrom-Json | ||
| $hasVulnerabilities = $false | ||
|
|
||
| foreach ($project in $json.projects) { | ||
| if (-not $project.frameworks) { | ||
| continue | ||
| } | ||
|
|
||
| $isTestProject = $project.path -like '*/test/*' | ||
|
|
||
| foreach ($framework in $project.frameworks) { | ||
| foreach ($package in $framework.topLevelPackages) { | ||
| $hasVulnerabilities = $true | ||
|
|
||
| foreach ($vulnerability in $package.vulnerabilities) { | ||
| Write-Host "$($project.path) ($($framework.framework)): top-level $($package.id) $($package.resolvedVersion) – $($vulnerability.severity): $($vulnerability.advisoryurl)" | ||
| } | ||
| } | ||
|
|
||
| if (-not $isTestProject) { | ||
| foreach ($package in $framework.transitivePackages) { | ||
| $hasVulnerabilities = $true | ||
|
|
||
| foreach ($vulnerability in $package.vulnerabilities) { | ||
| Write-Host "$($project.path) ($($framework.framework)): transitive $($package.id) $($package.resolvedVersion) – $($vulnerability.severity): $($vulnerability.advisoryurl)" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if ($hasVulnerabilities) { | ||
| exit 1 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| name: Cleanup Code | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
| DOTNET_NOLOGO: true | ||
| SOLUTION_FILE: 'Steeltoe.NetCoreToolService.slnx' | ||
|
|
||
| jobs: | ||
| verify: | ||
| name: Verify Code Style | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: | | ||
| 10.0.* | ||
|
|
||
| - name: Git checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 2 | ||
|
|
||
| - name: Restore tools | ||
| run: dotnet tool restore --verbosity minimal | ||
|
|
||
| - name: Restore packages | ||
| run: dotnet restore ${{ env.SOLUTION_FILE }} /p:Configuration=Release /p:NuGetAudit=false --verbosity minimal | ||
|
|
||
| - name: Build | ||
| run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release /p:RunAnalyzers=false | ||
|
|
||
| - name: CleanupCode (on PR diff) | ||
| if: ${{ github.event_name == 'pull_request' }} | ||
| shell: pwsh | ||
| run: | | ||
| # Not using the environment variables for SHAs, because they may be outdated. This may happen on force-push after the build is queued, but before it starts. | ||
| # The below works because HEAD is detached (at the merge commit), so HEAD~1 is at the base branch. When a PR contains no commits, this job will not run. | ||
| $headCommitHash = git rev-parse HEAD | ||
| $baseCommitHash = git rev-parse HEAD~1 | ||
|
|
||
| Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash in pull request." | ||
| dotnet jb cleanupcode --version | ||
| dotnet regitlint -s $env:SOLUTION_FILE --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff | ||
|
|
||
| - name: CleanupCode (on branch) | ||
| if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' }} | ||
| shell: pwsh | ||
| run: | | ||
| Write-Output 'Running code cleanup on all files.' | ||
| dotnet jb cleanupcode --version | ||
| dotnet regitlint -s $env:SOLUTION_FILE --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN --fail-on-diff --print-diff |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.