Skip to content

Commit 9876984

Browse files
committed
[edit] simplify CodeQL workflow, clean up code style
- Switch CodeQL runner from windows-2025-vs2026 to ubuntu-latest - Replace manual dotnet build with build-mode: none in CodeQL init - Update codeql-action from v3 to v4, revert checkout from v7 to v6 - Remove boilerplate comments from codeql-analysis.yml - Convert FooModel.cs to file-scoped namespace - Remove redundant _statusCode backing field in Json.cs, use primary constructor param directly
1 parent 92838e1 commit 9876984

3 files changed

Lines changed: 12 additions & 47 deletions

File tree

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
121
name: "CodeQL"
132

143
on:
@@ -22,7 +11,7 @@ on:
2211
jobs:
2312
analyze:
2413
name: Analyze
25-
runs-on: windows-2025-vs2026
14+
runs-on: ubuntu-latest
2615
permissions:
2716
actions: read
2817
contents: read
@@ -32,31 +21,16 @@ jobs:
3221
fail-fast: false
3322
matrix:
3423
language: ["csharp"]
35-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
36-
# Learn more:
37-
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
3824

3925
steps:
4026
- name: Checkout repository
41-
uses: actions/checkout@v7
27+
uses: actions/checkout@v6
4228

43-
# Initializes the CodeQL tools for scanning.
4429
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v3
30+
uses: github/codeql-action/init@v4
4631
with:
4732
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52-
53-
- name: Setup .NET
54-
uses: actions/setup-dotnet@v5
55-
with:
56-
dotnet-version: 9.0.x
57-
58-
# Build
59-
- run: dotnet build src/Simplify.Web.slnx -v minimal
33+
build-mode: none
6034

6135
- name: Perform CodeQL Analysis
62-
uses: github/codeql-action/analyze@v3
36+
uses: github/codeql-action/analyze@v4
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
namespace Simplify.Web.Tests.Model.Binding.Binders.TestTypes
1+
namespace Simplify.Web.Tests.Model.Binding.Binders.TestTypes;
2+
3+
public class FooModel
24
{
3-
public class FooModel
4-
{
5-
public int ID { get; set; }
6-
public string? Name { get; set; }
7-
}
8-
}
5+
public int ID { get; set; }
6+
public string? Name { get; set; }
7+
}

src/Simplify.Web/Responses/Json.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ namespace Simplify.Web.Responses;
1414
/// <param name="statusCode">The HTTP response status code.</param>
1515
public class Json(object objectToConvert, int statusCode = 200) : ControllerResponse
1616
{
17-
/// <summary>
18-
/// Gets the HTTP response status code.
19-
/// </summary>
20-
/// <value>
21-
/// The HTTP response status code.
22-
/// </value>
23-
private readonly int _statusCode = statusCode;
24-
2517
/// <summary>
2618
/// Gets or sets the default JsonSerializerOptions
2719
/// </summary>
@@ -36,7 +28,7 @@ public class Json(object objectToConvert, int statusCode = 200) : ControllerResp
3628
public override async Task<ResponseBehavior> ExecuteAsync()
3729
{
3830
Context.Response.ContentType = "application/json";
39-
Context.Response.StatusCode = _statusCode;
31+
Context.Response.StatusCode = statusCode;
4032

4133
await ResponseWriter.WriteAsync(Context.Response, JsonSerializer.Serialize(objectToConvert, DefaultOptions));
4234

0 commit comments

Comments
 (0)