Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve duplicate function detection to handle functions without function keyword #392

Merged

Conversation

ichoosetoaccept
Copy link

@ichoosetoaccept ichoosetoaccept commented Feb 12, 2025

The previous implementation assumed that function names would always be in the second field when using awk to extract them. This caused issues when the function keyword was omitted, as the function name could be in any field.

This fix:

  1. Scans all fields in each line for a pattern matching a test function name
  2. Uses a proper regex pattern to identify function names
  3. Only processes and prints actual function names
  4. Adds an explicit return 0 for clarity

Added test case to verify the fix works with function declarations that omit the function keyword.

… function keyword, fixed editorconfig issue

The previous implementation assumed that function names would always be in the second field when using awk to extract them. This caused issues when the function keyword was omitted, as the function name could be in any field.

This fix: 1. Scans all fields in each line for a pattern matching a test function name 2. Uses a proper regex pattern to identify function names 3. Only processes and prints actual function names 4. Adds an explicit return 0 for clarity

Added test case to verify the fix works with function declarations that omit the function keyword.
Copy link
Member

@Chemaclass Chemaclass left a comment

Choose a reason for hiding this comment

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

Awesome!

@Chemaclass Chemaclass added the bug Something isn't working label Feb 19, 2025
@Chemaclass Chemaclass merged commit 36f70ba into TypedDevs:main Feb 19, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants