Normalize C# and PowerShell formatting across sources and tests - #56
Conversation
- Apply consistent indentation and line wrapping - Normalize conditional expressions, constructors, collections, and assertions - Reformat rendering, stencil, persistence, and validation test fixtures - Preserve runtime behavior and test contracts
…tests - Align indentation and property spacing - Normalize comparison operators and pipeline formatting - Add missing trailing newlines to PowerShell files
There was a problem hiding this comment.
Pull request overview
This PR standardizes formatting across the repository’s C# test fixtures and PowerShell tooling/tests to improve consistency and readability while preserving runtime behavior and existing test contracts.
Changes:
- Normalize C# wrapping/indentation for assertions, constructors, collections, and long expressions (primarily in rendering/stencil/persistence/validation fixtures).
- Normalize PowerShell indentation, operator casing, and pipeline formatting; add missing trailing newlines in multiple scripts.
Reviewed changes
Copilot reviewed 40 out of 49 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Run-PureBaseRegression.ps1 | Reformat pipeline indentation and top-level output formatting. |
| Tests/Release/Run-PureBaseReleaseValidation.ps1 | Normalize hashtable alignment, pipeline continuation indentation, and add trailing newline. |
| Tests/Release/ConsumerProject/Assets/Editor/PureBaseConsumerRenderingModeTests.cs | Wrap long constants/calls/assertions for consistent C# formatting. |
| Tests/Release/ConsumerProject/Assets/Editor/PureBaseConsumerReleaseTests.cs | Wrap long constructor calls for readability/consistency. |
| Tests/Release/Build-PureBaseRelease.Tests.ps1 | Normalize ordered hashtable alignment and pipeline indentation. |
| Tests/Release/Build-PureBaseRelease.ps1 | Reformat ZIP audit/validation block indentation and operator casing. |
| Tests/Parity/Validate-PureBaseParity.ps1 | Normalize indentation/continuation formatting and operator casing. |
| Tests/Parity/Validate-PureBaseParity.Oracle.ps1 | Formatting-only newline normalization at file end. |
| Tests/Daily/Editor/PureBaseValidationSceneRegressionTests.cs | Wrap long calls/ternaries/assertions to consistent C# formatting. |
| Tests/Daily/Editor/PureBaseRenderingModeRenderingTests.ToonForwardAddScope.cs | Wrap long string concatenations, calls, and assertions for consistent formatting. |
| Tests/Daily/Editor/PureBaseRenderingModeRenderingTests.Stencil.cs | Wrap constructor calls and long assertions for consistent formatting. |
| Tests/Daily/Editor/PureBaseRenderingModeRenderingTests.cs | Wrap method signatures, allocations, and assertions for consistent formatting. |
| Tests/Daily/Editor/PureBaseRenderingModeContractTests.Support.cs | Remove extra blank lines and wrap long calls/conditions for consistency. |
| Tests/Daily/Editor/PureBaseRenderingModeContractTests.ProductContracts.cs | Reformat long arrays/constructors/assertions for consistent formatting. |
| Tests/Daily/Editor/PureBaseRenderingModeContractTests.MaterialState.cs | Normalize indentation and wrapping in snapshot/assertion helpers. |
| Tests/Daily/Editor/PureBaseRenderingModeContractTests.InspectorPersistence.cs | Wrap long reflection calls/assertions and normalize indentation. |
| Tests/Daily/Editor/PureBaseRenderingModeContractTests.cs | Compress empty partial type body to single-line form. |
| Tests/Daily/Editor/PureBaseRenderingModeContractTests.Atomicity.cs | Wrap long calls/conditions and normalize indentation. |
| Editor/PureBaseRenderingModeElement.cs | Wrap long strings, signatures, and conditionals for consistent formatting. |
| Editor/PureBaseRenderingMode.cs | Wrap long expressions/constructors/exception messages for consistent formatting. |
| Editor/PureBaseCutoffElement.cs | Wrap long signatures/conditions and normalize indentation. |
| .github/tests/UnityMetadata.Tests.ps1 | Normalize pipeline indentation and comparison operator casing; add trailing newline. |
| .github/tests/ShaderCorePhaseCompatibility.Tests.ps1 | Align PSCustomObject properties; add trailing newline. |
| .github/tests/RepositoryLineEndings.Tests.ps1 | Align PSCustomObject properties and normalize block indentation. |
| .github/tests/ReleaseValidationIsolation.Tests.ps1 | Add trailing newline. |
| .github/tests/ReleasePublishTag.Tests.ps1 | Align PSCustomObject properties; add trailing newline. |
| .github/tests/ReleaseAuthorization.Tests.ps1 | Align ordered hashtable keys; add trailing newline. |
| .github/tests/PureBase.Automation.Tests.ps1 | Normalize pipeline indentation and operator casing; add trailing newline. |
| .github/tests/New-PureBaseCiProject.Tests.ps1 | Normalize list spacing and add trailing newline. |
| .github/tests/InstallPinnedUnityCli.Tests.ps1 | Formatting-only newline normalization at file end. |
| .github/tests/HostedUnityReviewContracts.Tests.ps1 | Normalize indentation in pipelines/scriptblocks and add trailing newline. |
| .github/tests/Export-PureBaseValidationZip.Tests.ps1 | Formatting-only newline normalization at file end. |
| .github/scripts/UnityWatchdogProxy.ps1 | Add trailing newline. |
| .github/scripts/Test-RepositoryLineEndings.ps1 | Normalize spacing around unary comma returns and PSCustomObject alignment. |
| .github/scripts/Resolve-UnityEditorPath.ps1 | Add trailing newline. |
| .github/scripts/PureBase.ReleasePublication.psm1 | Reformat Export-ModuleMember parameter layout and add trailing newline. |
| .github/scripts/PureBase.Automation.psm1 | Normalize ordered hashtable alignment, operator casing, and add trailing newline. |
| .github/scripts/New-PureBaseCiProject.ps1 | Normalize indentation across script and add trailing newline. |
| .github/scripts/Invoke-PureBaseRelease.ps1 | Add trailing newline. |
| .github/scripts/Install-VerifiedShaderCoreRelease.Tests.ps1 | Add trailing newline. |
| .github/scripts/Install-VerifiedShaderCoreRelease.ps1 | Add trailing newline. |
| .github/scripts/Get-ReleaseAuthorizationPredicate.ps1 | Align ordered hashtable keys and add trailing newline. |
| .github/scripts/Export-PureBaseValidationZip.ps1 | Normalize pipeline indentation and operator casing; add trailing newline. |
| .github/actions/lookup-unity-editor-cache/Install-PinnedUnityCli.ps1 | Formatting-only newline normalization at file end. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| BestPractice | 3 medium |
| CodeStyle | 7 minor |
| Complexity | 9 medium |
🟢 Metrics 0 complexity · 0 duplication
Metric Results Complexity 0 Duplication 0
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
This PR performs an extensive normalization of C# and PowerShell formatting across 47 files. Although the changes are intended to be purely aesthetic, the Codacy analysis indicates the PR is currently not up to standards, with 19 new issues reported.
Key concerns include the introduction of multi-line control structures that lack explicit braces, which can obscure logic flow and complicate future maintenance. Given the high volume of changes across production and test code, there is an elevated risk of accidental logic regressions that are difficult to verify through static analysis alone. It is recommended to address the specific style violations and ensure all automated tests pass in the CI pipeline before merging.
About this PR
- The PR scope is exceptionally large, touching a wide variety of production and test code. This carries an inherent risk of accidental regression despite the 'formatting only' intent. Ensure that full CI test suites have been executed and verified against this branch.
Test suggestions
- Verify C# method signatures with multiple parameters are wrapped across several lines for readability.
- Verify PowerShell ordered hashtables have keys aligned with consistent spacing.
- Verify PowerShell pipelines use indentation for downstream filters like Where-Object.
- Verify trailing newlines are present in modified .ps1 and .psm1 files.
- Verify C# logic blocks (if/else) use consistent brace placement and multi-line conditions where complex.
Low confidence findings
- Verification of 'preserved runtime behavior' is difficult to assess purely from the diff. Functional coverage data or detailed CI execution logs should be reviewed to confirm that no logic was inadvertently altered during normalization.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
| /// <summary>Initializes an allocation-free ShadowCaster readback fixture.</summary> | ||
| public ShadowReadbackFixture() { } |
There was a problem hiding this comment.
⚪ LOW RISK
Remove this redundant empty constructor and its accompanying summary documentation to simplify the class. The compiler automatically generates a public parameterless constructor if no other constructors are defined.
| throw new ArgumentNullException(nameof(materials)); | ||
| if (mode < (int)PureBaseRenderingMode.Opaque || mode > (int)PureBaseRenderingMode.Transparent) | ||
| throw new ArgumentOutOfRangeException(nameof(mode), mode, "The rendering mode must be Opaque, Cutout, or Transparent."); | ||
| if ( |
There was a problem hiding this comment.
⚪ LOW RISK
Suggestion: Enclose the body of this multi-line 'if' statement in curly braces for better clarity and to adhere to recommended C# coding standards. Try running the following prompt in your IDE agent: > In Editor/PureBaseRenderingModeElement.cs, add curly braces to the 'if' statement at line 143 that checks 'mode < (int)PureBaseRenderingMode.Opaque'.
| int renderingModePropertyIndex = shader.FindPropertyIndex(RenderingModePropertyName); | ||
| if (renderingModePropertyIndex < 0 || shader.GetPropertyType(renderingModePropertyIndex) != ShaderPropertyType.Int) | ||
| throw CreateValidationException(material, "it does not expose the Pure-Base integer rendering-mode property"); | ||
| if ( |
There was a problem hiding this comment.
⚪ LOW RISK
Suggestion: Add curly braces to this 'if' statement. The current reformatting makes the control flow less obvious without explicit block delimiters. Try running the following prompt in your IDE agent: > In Editor/PureBaseRenderingMode.cs, add curly braces to the 'if' statement at line 167 that checks 'renderingModePropertyIndex < 0'.
- Allow horizontal alignment in release predicate source contracts and update the attestation SHA expectation. - Verified with Pester 5.9.0 targeted and clean-worktree full automation suites.
C#
PowerShell