From 162de2ed557c9f7f273262ea4692ebc5381b1497 Mon Sep 17 00:00:00 2001 From: Stephen Walsh <868017+stphnwlsh@users.noreply.github.com> Date: Wed, 28 Oct 2026 20:10:23 +0000 Subject: [PATCH] chore: remove dead code, unused packages and leftover config --- .github/workflows/build-pipeline.yml | 24 +++---- Dockerfile | 3 - src/Application/Application.csproj | 9 --- src/Infrastructure/Infrastructure.csproj | 3 - src/Presentation/Logging/ApplicationLog.cs | 72 ------------------- src/Presentation/Presentation.csproj | 10 --- .../Infrastructure.Tests.Integration.csproj | 1 - .../Extensions/JsonSerializerExtensions.cs | 5 -- .../Presentation.Tests.Integration.csproj | 1 - 9 files changed, 8 insertions(+), 120 deletions(-) delete mode 100644 src/Presentation/Logging/ApplicationLog.cs diff --git a/.github/workflows/build-pipeline.yml b/.github/workflows/build-pipeline.yml index 71cd8f8..a7a6f50 100644 --- a/.github/workflows/build-pipeline.yml +++ b/.github/workflows/build-pipeline.yml @@ -25,7 +25,6 @@ jobs: outputs: name: ${{ steps.initialize.outputs.name }} - docker_tag: ${{ steps.initialize.outputs.docker_tag }} version: ${{ steps.initialize.outputs.version }} steps: @@ -38,8 +37,6 @@ jobs: run: | NAME=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]') VERSION_PREFIX=$(date +'%Y.%m.%d').${GITHUB_RUN_NUMBER} - BRANCH_CURRENT=${GITHUB_REF#refs/*/} - BRANCH_CURRENT=${BRANCH_CURRENT//[^a-zA-Z0-9]/-} if [[ ${GITHUB_EVENT_NAME} == 'pull_request' ]]; then BRANCH_BASE=${GITHUB_BASE_REF#refs/*/} @@ -47,22 +44,18 @@ jobs: BRANCH_COMPARE=${GITHUB_HEAD_REF#refs/*/} BRANCH_COMPARE=${BRANCH_COMPARE//[^a-zA-Z0-9]/-} VERSION_SUFFIX="merge-${BRANCH_BASE}-${BRANCH_COMPARE}" - elif [[ ${GITHUB_EVENT_NAME} == ${{ github.event.repository.default_branch }} ]]; then - VERSION_SUFFIX="${BRANCH_CURRENT}" fi if [[ $VERSION_SUFFIX == '' ]]; then - DOCKER_TAG=$VERSION_PREFIX + VERSION=$VERSION_PREFIX else - DOCKER_TAG=$VERSION_PREFIX-$VERSION_SUFFIX + VERSION=$VERSION_PREFIX-$VERSION_SUFFIX fi echo "name=$(eval printf "%s" "$NAME")" >> $GITHUB_OUTPUT echo "version_prefix=$(eval printf "%s" "$VERSION_PREFIX")" >> $GITHUB_OUTPUT echo "version_suffix=$(eval printf "%s" "$VERSION_SUFFIX")" >> $GITHUB_OUTPUT - echo "docker_tag=$(eval printf "%s" "$DOCKER_TAG")" >> $GITHUB_OUTPUT - echo "version=$(eval printf "%s" "$DOCKER_TAG")" >> $GITHUB_OUTPUT - echo "branch=$(eval printf "%s" "$BRANCH_CURRENT")" >> $GITHUB_OUTPUT + echo "version=$(eval printf "%s" "$VERSION")" >> $GITHUB_OUTPUT shell: bash - name: Test @@ -82,17 +75,16 @@ jobs: run: | docker build . \ --target run \ - --tag $NAME:$DOCKER_TAG \ - --tag $NAME:latest \ + --tag $NAME:$VERSION \ --build-arg VERSION_PREFIX=$VERSION_PREFIX \ --build-arg VERSION_SUFFIX=$VERSION_SUFFIX - docker save $NAME:$DOCKER_TAG $NAME:latest --output image.tar + docker save $NAME:$VERSION --output image.tar env: DOCKER_BUILDKIT: 1 NAME: ${{ steps.initialize.outputs.name }} VERSION_PREFIX: ${{ steps.initialize.outputs.version_prefix }} VERSION_SUFFIX: ${{ steps.initialize.outputs.version_suffix }} - DOCKER_TAG: ${{ steps.initialize.outputs.docker_tag }} + VERSION: ${{ steps.initialize.outputs.version }} - name: Setup .NET id: setup @@ -237,7 +229,7 @@ jobs: id: scan uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 with: - image-ref: ${{ needs.build.outputs.name }}:${{ needs.build.outputs.docker_tag }} + image-ref: ${{ needs.build.outputs.name }}:${{ needs.build.outputs.version }} format: sarif output: trivy-results.sarif severity: CRITICAL,HIGH @@ -254,7 +246,7 @@ jobs: id: enforce uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 with: - image-ref: ${{ needs.build.outputs.name }}:${{ needs.build.outputs.docker_tag }} + image-ref: ${{ needs.build.outputs.name }}:${{ needs.build.outputs.version }} format: table severity: CRITICAL,HIGH ignore-unfixed: true diff --git a/Dockerfile b/Dockerfile index f48f40e..ce0023f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,9 +27,6 @@ RUN for file in $(ls *.csproj); do mkdir -p tests/${file%.*}/ && mv $file tests/ RUN dotnet restore -v minimal -# Bust Cache -ARG CACHE_BUST 1 - # Copy Remaining Files COPY . . diff --git a/src/Application/Application.csproj b/src/Application/Application.csproj index 46513f3..b16faf7 100644 --- a/src/Application/Application.csproj +++ b/src/Application/Application.csproj @@ -11,13 +11,4 @@ - - - <_Parameter1>$(AssemblyName).Tests.Unit - - - <_Parameter1>DynamicProxyGenAssembly2 - - - diff --git a/src/Infrastructure/Infrastructure.csproj b/src/Infrastructure/Infrastructure.csproj index 5b748e9..ada2a82 100644 --- a/src/Infrastructure/Infrastructure.csproj +++ b/src/Infrastructure/Infrastructure.csproj @@ -18,9 +18,6 @@ <_Parameter1>$(AssemblyName).Tests.Integration - - <_Parameter1>DynamicProxyGenAssembly2 - diff --git a/src/Presentation/Logging/ApplicationLog.cs b/src/Presentation/Logging/ApplicationLog.cs deleted file mode 100644 index 7f4e0c0..0000000 --- a/src/Presentation/Logging/ApplicationLog.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace CleanModelContextProtocol.Presentation.Logging; - -/// -/// High-performance structured logging using LoggerMessage source generators. -/// This class provides compile-time optimized logging methods. -/// -public static partial class ApplicationLog -{ - // Endpoint logging - [LoggerMessage( - EventId = 1000, - Level = LogLevel.Information, - Message = "Processing {EndpointName} request")] - public static partial void ProcessingRequest(ILogger logger, string endpointName); - - [LoggerMessage( - EventId = 1001, - Level = LogLevel.Information, - Message = "Completed {EndpointName} request in {ElapsedMs}ms")] - public static partial void CompletedRequest(ILogger logger, string endpointName, long elapsedMs); - - // Entity operations - [LoggerMessage( - EventId = 2000, - Level = LogLevel.Information, - Message = "Creating {EntityType} with Id {EntityId}")] - public static partial void CreatingEntity(ILogger logger, string entityType, Guid entityId); - - [LoggerMessage( - EventId = 2001, - Level = LogLevel.Information, - Message = "Updated {EntityType} with Id {EntityId}")] - public static partial void UpdatedEntity(ILogger logger, string entityType, Guid entityId); - - [LoggerMessage( - EventId = 2002, - Level = LogLevel.Information, - Message = "Deleted {EntityType} with Id {EntityId}")] - public static partial void DeletedEntity(ILogger logger, string entityType, Guid entityId); - - [LoggerMessage( - EventId = 2003, - Level = LogLevel.Warning, - Message = "{EntityType} with Id {EntityId} not found")] - public static partial void EntityNotFound(ILogger logger, string entityType, Guid entityId); - - // Error logging - [LoggerMessage( - EventId = 3000, - Level = LogLevel.Error, - Message = "Error processing {Operation}: {ErrorMessage}")] - public static partial void ErrorProcessingOperation(ILogger logger, Exception exception, string operation, string errorMessage); - - [LoggerMessage( - EventId = 3001, - Level = LogLevel.Warning, - Message = "Validation failed for {EndpointName}: {ValidationErrors}")] - public static partial void ValidationFailed(ILogger logger, string endpointName, string validationErrors); - - // Database operations - [LoggerMessage( - EventId = 4000, - Level = LogLevel.Debug, - Message = "Executing database query: {QueryType}")] - public static partial void ExecutingQuery(ILogger logger, string queryType); - - [LoggerMessage( - EventId = 4001, - Level = LogLevel.Debug, - Message = "Database query completed: {QueryType} returned {ResultCount} results")] - public static partial void QueryCompleted(ILogger logger, string queryType, int resultCount); -} diff --git a/src/Presentation/Presentation.csproj b/src/Presentation/Presentation.csproj index 7afb79b..757d109 100644 --- a/src/Presentation/Presentation.csproj +++ b/src/Presentation/Presentation.csproj @@ -12,8 +12,6 @@ $(NoWarn);1591 - - all @@ -23,7 +21,6 @@ - @@ -40,11 +37,4 @@ - - - images/icon.png - PreserveNewest - - - diff --git a/tests/Infrastructure.Tests.Integration/Infrastructure.Tests.Integration.csproj b/tests/Infrastructure.Tests.Integration/Infrastructure.Tests.Integration.csproj index d633519..e84b8f1 100644 --- a/tests/Infrastructure.Tests.Integration/Infrastructure.Tests.Integration.csproj +++ b/tests/Infrastructure.Tests.Integration/Infrastructure.Tests.Integration.csproj @@ -12,7 +12,6 @@ - diff --git a/tests/Presentation.Tests.Integration/Extensions/JsonSerializerExtensions.cs b/tests/Presentation.Tests.Integration/Extensions/JsonSerializerExtensions.cs index 1b97bf3..fb97988 100644 --- a/tests/Presentation.Tests.Integration/Extensions/JsonSerializerExtensions.cs +++ b/tests/Presentation.Tests.Integration/Extensions/JsonSerializerExtensions.cs @@ -17,11 +17,6 @@ public static class JsonSerializerExtensions } }; - public static string Serialize(this object input) - { - return JsonSerializer.Serialize(input, Options); - } - public static T Deserialize(this string input) { return JsonSerializer.Deserialize(input, Options); diff --git a/tests/Presentation.Tests.Integration/Presentation.Tests.Integration.csproj b/tests/Presentation.Tests.Integration/Presentation.Tests.Integration.csproj index 9029838..58b1e5b 100644 --- a/tests/Presentation.Tests.Integration/Presentation.Tests.Integration.csproj +++ b/tests/Presentation.Tests.Integration/Presentation.Tests.Integration.csproj @@ -12,7 +12,6 @@ -