removed some stuff I shouldn't have - #2247
Conversation
8327cc0 to
16b7a93
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR is currently not up to standards according to Codacy, with 250 new issues and 113 new clones detected. A significant logic error in the diagnostic filtering logic (VerifyGeneratorTextContext.cs) suggests that the 'Implement diagnostic severity filtering' acceptance criterion is not correctly fulfilled; the current implementation likely filters out all diagnostics when no filter is provided.
Furthermore, the PR introduces critical portability issues by hardcoding local Windows filesystem paths in the NuGet configuration and including IDE-specific metadata. These issues must be addressed to ensure the project remains buildable in CI/CD and cross-platform environments.
About this PR
- The PR title is generic and lacks a description, which hinders the review process. Additionally, IDE-specific configuration files (the
.ideafolder) are being committed. These should be removed and added to.gitignoreto keep the repository clean of environment-specific metadata.
Test suggestions
- Verify diagnostic filtering by severity level in Source Generator tests.
- Ensure CancellationToken is correctly passed to the generator GenerateAsync method.
- Verify TUnit logging sink correctly captures and formats logs.
- Verify XUnit integration correctly resolves types using AutoFake, AutoMock, and AutoSubstitute containers.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
| if (customizer.GetInvocationList() is { Length: > 0, } methods) | ||
| { | ||
| return (results, target, data) => | ||
| return customizer.GetInvocationList() is { Length: > 0, } methods |
There was a problem hiding this comment.
🔴 HIGH RISK
Safely access the invocation list of the 'customizer' delegate using the null-conditional operator to prevent a NullReferenceException.
| return customizer.GetInvocationList() is { Length: > 0, } methods | |
| return customizer?.GetInvocationList() is { Length: > 0, } methods |
| <add key="automatic" value="True" /> | ||
| </packageRestore> | ||
| <packageSources> | ||
| <add key="local" value="C:\Development\RocketSurgeonsGuild\Testing\artifacts\nuget\" /> |
There was a problem hiding this comment.
🔴 HIGH RISK
Avoid using absolute local paths (e.g., C:\...) in NuGet.config. This prevents the repository from being portable and will cause build failures in CI/CD environments or on other developers' machines. Use relative paths instead.
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <module external.system.id="pyproject.toml" type="PYTHON_MODULE" version="4"> | ||
| <component name="NewModuleRootManager"> | ||
| <content url="file://$MODULE_DIR$/../../apm_modules/dotnet/skills/tests/dotnet-test/code-testing-agent/fixtures/python-workspace-integrity" /> |
There was a problem hiding this comment.
🟡 MEDIUM RISK
Avoid referencing paths outside the repository boundaries (e.g., ../../apm_modules/...). This prevents the project from being self-contained.
| data["FinalDiagnostics"] = target.FinalDiagnostics.Where(s => s.Severity >= target.Severity).OrderDiagnosticResults(); | ||
| data["GeneratorDiagnostics"] = target.Results.ToDictionary(z => z.Key.FullName!, z => z.Value.Diagnostics.OrderDiagnosticResults()); | ||
| data["AnalyzerDiagnostics"] = target.AnalyzerResults.ToDictionary(z => z.Key.FullName!, z => z.Value.Diagnostics.OrderDiagnosticResults()); | ||
| data["GeneratorDiagnostics"] = target.Results.ToDictionary(z => z.Key.FullName!, z => z.Value.Diagnostics.Where(s => s.Severity >= target.Severity).OrderDiagnosticResults()); |
There was a problem hiding this comment.
🟡 MEDIUM RISK
The filtering logic s.Severity >= target.Severity will return false if target.Severity is null (the default). This results in all diagnostics being filtered out when no specific filter is requested. Update the logic to include all diagnostics by default, e.g., s.Severity >= (target.Severity ?? DiagnosticSeverity.Hidden).
| { | ||
| return new(new { target.Diagnostics, }, target.SyntaxTrees.Select(Customizers.Selector)); | ||
| } | ||
| private static ConversionResult Convert(GeneratorTestResult target, IReadOnlyDictionary<string, object> context) => new(new { target.Diagnostics, }, target.SyntaxTrees.Select(Customizers.Selector)); |
There was a problem hiding this comment.
🔴 HIGH RISK
Potential null dereference of 'target'. Consider using null-safe navigation or adding a guard clause.
| private static ConversionResult Convert(GeneratorTestResult target, IReadOnlyDictionary<string, object> context) => new(new { target.Diagnostics, }, target.SyntaxTrees.Select(Customizers.Selector)); | |
| private static ConversionResult Convert(GeneratorTestResult target, IReadOnlyDictionary<string, object> context) => new(new { target?.Diagnostics, }, target?.SyntaxTrees.Select(Customizers.Selector) ?? []); |
| public static TestRecord Create( | ||
| TestContext testContext, | ||
| LogEventLevel logEventLevel = LogEventLevel.Verbose, | ||
| string? outputTemplate = null |
There was a problem hiding this comment.
🟡 MEDIUM RISK
Suggestion: Avoid using optional parameters in public methods to maintain better backward compatibility and stable binary contracts. Consider using method overloading for the 'Create' method instead.
| public void GetTestUniqueId() => outputHelper.GetTestUniqueId().ShouldBe("66d256d940db996ce53528d6d76407726a8eaa10"); | ||
|
|
||
| [Fact] | ||
| public void GetTestHashId() => outputHelper.GetTestHashId().ShouldBe(-485969091); |
There was a problem hiding this comment.
⚪ LOW RISK
Suggestion: Avoid asserting against hardcoded hash results. Hash implementations are not guaranteed to be stable across different .NET runtimes or architectures, which can lead to flaky tests.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2247 +/- ##
=======================================
Coverage 45.21% 45.21%
=======================================
Files 38 38
Lines 3001 3001
Branches 185 185
=======================================
Hits 1357 1357
Misses 1594 1594
Partials 50 50 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Compatibility | 66 medium |
| UnusedCode | 14 medium |
| BestPractice | 7 medium |
| CodeStyle | 2 minor |
| Performance | 11 high |
🟢 Metrics 111 complexity · 115 duplication
Metric Results Complexity 111 Duplication 115
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
No description provided.