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

Method names should start with a lower case letter #100

Closed
faris-git opened this issue Mar 23, 2022 · 2 comments · Fixed by #105
Closed

Method names should start with a lower case letter #100

faris-git opened this issue Mar 23, 2022 · 2 comments · Fixed by #105
Labels
needs discussion PR welcome A PR submitted for this issue would be welcome

Comments

@faris-git
Copy link

As my SAST vulnerability report tool always complain that "Method names should start with a lower case letter". Is there any reason to use static constructor method name with capital letter.

@RecordBuilder
public record MyRecord(String name){}

The generated code:

     /**
     * Static constructor/builder. Can be used instead of new MyRecord(...)
     */
    @Generated("io.soabase.recordbuilder.core.RecordBuilder")
    public static MyRecord MyRecord(String name) {...}

Identifier: Find Security Bugs-NM_METHOD_NAMING_CONVENTION

May be it would be great if we can configure the method name conventions.

Expected generated code:

/**
  * Static constructor/builder. Can be used instead of new MyRecord(...)
  */
 @Generated("io.soabase.recordbuilder.core.RecordBuilder")
 public static MyRecord myRecord(String name) {...}
@Randgalt
Copy link
Owner

This is a common pattern in FP. You can see an example of it here: https://github.com/Randgalt/expressive-java - we could add an option, though, to not generate the method.

@Randgalt Randgalt added PR welcome A PR submitted for this issue would be welcome needs discussion labels Apr 3, 2022
Randgalt added a commit that referenced this issue Apr 7, 2022
Randgalt added a commit that referenced this issue Apr 8, 2022
Randgalt added a commit that referenced this issue Apr 8, 2022
@faris-git
Copy link
Author

Thanks @Randgalt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs discussion PR welcome A PR submitted for this issue would be welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants