Skip to content

Add more cases for recursive call analyzer#297

Merged
SergeyTeplyakov merged 3 commits intomasterfrom
recursivecallanalyzer
Jun 3, 2025
Merged

Add more cases for recursive call analyzer#297
SergeyTeplyakov merged 3 commits intomasterfrom
recursivecallanalyzer

Conversation

@SergeyTeplyakov
Copy link
Copy Markdown
Owner

No description provided.

@SergeyTeplyakov SergeyTeplyakov requested a review from Copilot June 3, 2025 04:39
Copy link
Copy Markdown
Contributor

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 refines the recursive call analyzer to only report diagnostics when a method calls itself with the exact same parameters, and adds tests to cover non-identical argument scenarios.

  • Analyzer now checks that each argument is a direct reference to the corresponding parameter before reporting recursion.
  • Tests added for calls with different literals and for the classic Factorial(n - 1) pattern.
  • Removed an unused using directive in the test file.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/ErrorProne.NET.CoreAnalyzers/RecursiveCallAnalyzer.cs Added parameter-by-parameter check before reporting.
src/ErrorProne.NET.CoreAnalyzers.Tests/RecursiveCallAnalyzerTests.cs Removed unused import; added tests for new cases.
Comments suppressed due to low confidence (1)

src/ErrorProne.NET.CoreAnalyzers.Tests/RecursiveCallAnalyzerTests.cs:38

  • [nitpick] Add tests for other argument-passing patterns, such as named arguments and ref/out parameters, to ensure the analyzer correctly allows or flags those recursive calls.
[Test]

Comment thread src/ErrorProne.NET.CoreAnalyzers/RecursiveCallAnalyzer.cs
@SergeyTeplyakov SergeyTeplyakov merged commit d4d68e3 into master Jun 3, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants