Skip to content

feat: trim common white-space from subject#739

Merged
vbreuss merged 1 commit intomainfrom
topic/trim-common-whitespace-for-subject
Aug 26, 2025
Merged

feat: trim common white-space from subject#739
vbreuss merged 1 commit intomainfrom
topic/trim-common-whitespace-for-subject

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Aug 26, 2025

This PR introduces a new feature to automatically trim common whitespace from assertion subjects in error messages, improving readability when dealing with multi-line formatted code. The primary change adds a TrimCommonWhiteSpace extension method and applies it to the ExpectationBuilder subject processing.

Key changes

  • Adds a new TrimCommonWhiteSpace string extension method that identifies and removes common leading whitespace from multi-line strings
  • Integrates the whitespace trimming into the ExpectationBuilder to automatically clean up subject expressions
  • Temporarily sets build scope to CoreOnly for development/testing purposes

@vbreuss vbreuss self-assigned this Aug 26, 2025
Copilot AI review requested due to automatic review settings August 26, 2025 17:59
@vbreuss vbreuss added the enhancement New feature or request label Aug 26, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new feature to automatically trim common whitespace from assertion subjects in error messages, improving readability when dealing with multi-line formatted code. The primary change adds a TrimCommonWhiteSpace extension method and applies it to the ExpectationBuilder subject processing.

  • Adds a new TrimCommonWhiteSpace string extension method that identifies and removes common leading whitespace from multi-line strings
  • Integrates the whitespace trimming into the ExpectationBuilder to automatically clean up subject expressions
  • Temporarily sets build scope to CoreOnly for development/testing purposes

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Source/aweXpect.Core/Core/Helpers/StringExtensions.cs Implements the TrimCommonWhiteSpace method with logic to find and remove common leading whitespace from multi-line strings
Source/aweXpect.Core/Core/ExpectationBuilder.cs Applies whitespace trimming to subject expressions in the constructor
Tests/aweXpect.Core.Tests/Core/Helpers/StringExtensionsTests.cs Restructures existing tests into nested classes and adds comprehensive test coverage for the new TrimCommonWhiteSpace method
Tests/aweXpect.Core.Tests/Core/ExpectationBuilderTests.cs Adds integration test verifying that multi-line subjects have their whitespace properly trimmed in error messages
Pipeline/Build.cs Temporarily changes build scope to CoreOnly (likely for development/testing)

Comment thread Source/aweXpect.Core/Core/Helpers/StringExtensions.cs
Comment thread Source/aweXpect.Core/Core/Helpers/StringExtensions.cs
Comment thread Pipeline/Build.cs
@vbreuss vbreuss changed the title feat: trim common white-space from subject feat: Trim common white-space from subject Aug 26, 2025
@vbreuss vbreuss changed the title feat: Trim common white-space from subject feat: trim common white-space from subject Aug 26, 2025
@vbreuss vbreuss enabled auto-merge (squash) August 26, 2025 18:02
@sonarqubecloud
Copy link
Copy Markdown

@vbreuss vbreuss disabled auto-merge August 26, 2025 18:04
@vbreuss vbreuss merged commit 46910c7 into main Aug 26, 2025
12 checks passed
@vbreuss vbreuss deleted the topic/trim-common-whitespace-for-subject branch August 26, 2025 18:04
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 2, 2025

This is addressed in release v2.22.0.

@github-actions github-actions Bot added the state: released The issue is released label Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants