Skip to content

SLANG Add rule to detect slice equality functions that can use slices…#339

Closed
paulnegz wants to merge 1 commit intoSonarSource:masterfrom
paulnegz:SLANG-slice-equal-refactoring
Closed

SLANG Add rule to detect slice equality functions that can use slices…#339
paulnegz wants to merge 1 commit intoSonarSource:masterfrom
paulnegz:SLANG-slice-equal-refactoring

Conversation

@paulnegz
Copy link
Copy Markdown

….Equal

  • Implements SliceEqualSimplificationCheck to detect custom slice equality functions that can be replaced with Go's built-in slices.Equal() function
  • Detects functions with 2 parameters that contain len() comparisons
  • Includes comprehensive test coverage with SLang syntax examples
  • Addresses refactoring opportunity similar to refactor: use slices.Equal to simplify code ollama/ollama#11502

This rule helps Go developers modernize their code by identifying opportunities to use the standard library's optimized slice comparison instead of custom implementations.

Part of

….Equal

* Implements SliceEqualSimplificationCheck to detect custom slice equality
  functions that can be replaced with Go's built-in slices.Equal() function
* Detects functions with 2 parameters that contain len() comparisons
* Includes comprehensive test coverage with SLang syntax examples
* Addresses refactoring opportunity similar to ollama/ollama#11502

This rule helps Go developers modernize their code by identifying
opportunities to use the standard library's optimized slice comparison
instead of custom implementations.
@paulnegz
Copy link
Copy Markdown
Author

@irina-batinic-sonarsource I'll appreciate if I can get a review and feedback for this. Open to making adjustments to move this forward

@dorian-burihabwa-sonarsource
Copy link
Copy Markdown
Contributor

Hi @paulnegz,
Thanks for your contribution. Someone will follow up within in a few days to look into your suggestion so there should be no need to ping anyone specifically.

Cheers,

Dorian

@mstachniuk
Copy link
Copy Markdown
Contributor

Hi @paulnegz
I send you E-Mail with some question, please answer before moving forward!

@paulnegz paulnegz closed this Jul 30, 2025
@paulnegz
Copy link
Copy Markdown
Author

SonarSource/sonar-go#100

@paulnegz paulnegz reopened this Jul 30, 2025
@paulnegz
Copy link
Copy Markdown
Author

paulnegz commented Jul 30, 2025

moved to

@paulnegz paulnegz closed this Jul 30, 2025
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.

3 participants